Movatterモバイル変換


[0]ホーム

URL:


CN114218503A - Attention relationship caching method and device, electronic equipment and computer storage medium - Google Patents

Attention relationship caching method and device, electronic equipment and computer storage medium
Download PDF

Info

Publication number
CN114218503A
CN114218503ACN202210161520.5ACN202210161520ACN114218503ACN 114218503 ACN114218503 ACN 114218503ACN 202210161520 ACN202210161520 ACN 202210161520ACN 114218503 ACN114218503 ACN 114218503A
Authority
CN
China
Prior art keywords
user
relationship
target
cache
concern
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210161520.5A
Other languages
Chinese (zh)
Other versions
CN114218503B (en
Inventor
王玉梅
商帆
孙成新
陈实
张益军
王金明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Feihu Information Technology Tianjin Co Ltd
Original Assignee
Feihu Information Technology Tianjin Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Feihu Information Technology Tianjin Co LtdfiledCriticalFeihu Information Technology Tianjin Co Ltd
Priority to CN202210161520.5ApriorityCriticalpatent/CN114218503B/en
Publication of CN114218503ApublicationCriticalpatent/CN114218503A/en
Application grantedgrantedCritical
Publication of CN114218503BpublicationCriticalpatent/CN114218503B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

The application provides a method and a device for caching concern relationships, electronic equipment and a computer storage medium, wherein the method comprises the following steps: if the effective first target concern relationship does not exist in the database and the existing record of the first target concern relationship does not exist in the database, generating a new record of the first target concern relationship; if the user in the first target concern relationship is a user in the high-level user group, storing the first target concern relationship into a high-level user cache; if the user in the first target concern relationship is not the user in the advanced user group and the user in the first target concern relationship reaches the standard of the advanced user, upgrading the user in the first target concern relationship into the advanced user, and storing the first target concern relationship into an advanced user cache; and if the user in the first target attention relationship does not meet the standard of the high-level user, storing the first target attention relationship into a common user cache. Therefore, the aim of effectively improving the caching efficiency is fulfilled.

Description

Attention relationship caching method and device, electronic equipment and computer storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for caching attention relationships, an electronic device, and a computer storage medium.
Background
Currently, there are many solutions for the caching process of concern relationship, and there are two typical solutions: the first solution is to cache the attention list and the fan list with the Hash structure of Redis, respectively. The second solution is to cache the attention list and the fan list with the Zset structure of Redis, respectively. The advantages of both of these schemes are the same: the addition and deletion are easy to operate, and the attention relationship is easy to inquire.
However, it is not applicable to users who have a lot of fans or much attention. The Hash structure or the Zset structure of one Redis becomes a large Key, the cache is slowed down, and the response time of newly adding and deleting is prolonged.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for caching a concern relationship, an electronic device, and a computer storage medium, which can effectively improve caching efficiency.
A first aspect of the present application provides a method for caching concern relationships, including:
receiving a request for a new concern relationship; the newly-added concern relation request comprises a first target concern relation needing to be newly added;
judging whether the effective first target concern relationship exists in a database;
if the first target concern relationship is judged not to exist in the database, judging whether a record of the first target concern relationship exists in the database or not;
if the existence record of the first target concern relationship does not exist in the database, generating a new record of the first target concern relationship;
if the existence record of the first target concern relationship exists in the database, modifying the existence record of the first target concern relationship;
judging whether the user in the first target attention relationship is a user in an advanced user group or not;
if the user in the first target concern relationship is judged to be a user in a high-level user group, storing the first target concern relationship into a high-level user cache, and generating a first cache result; wherein the first cache result indicates that the first target concern relationship is successfully added;
if the user in the first target attention relationship is judged not to be a user in an advanced user group, judging whether the user in the first target attention relationship meets the standard of an advanced user or not;
if the user in the first target concern relationship is judged to reach the standard of a high-level user, upgrading the user in the first target concern relationship into the high-level user, storing the first target concern relationship into a high-level user cache, and generating a first cache result;
and if the user in the first target attention relationship is judged not to meet the standard of the advanced user, storing the first target attention relationship into a common user cache, and generating a first cache result.
Optionally, the method for caching the concern relationship further includes:
if the effective first target concern relationship exists in the database, generating a second cache result; and the second cache result shows that the first target concern relationship already exists in the current database, and caching is not required to be carried out again.
Optionally, the method for caching the concern relationship further includes:
receiving a request for canceling the concern relationship; wherein the request for canceling attention relationship comprises a second target attention relationship which needs to be canceled;
judging whether the effective second target concern relationship exists in a database or not;
if the effective second target concern relationship does not exist in the database, generating a first cancellation result; the first cancellation result is used for indicating that the second target concern relationship does not exist in the database and the cancellation operation cannot be carried out;
if the effective second target concern relationship exists in the database, modifying the existence record of the second target concern relationship;
judging whether the user in the second target attention relationship is a common user or not;
if the user in the second target attention relationship is judged to be a common user, deleting according to the first cache deleting logic and generating a second canceling result; wherein the second cancellation result indicates that the second target attention relationship is successfully cancelled;
and if the user in the second target attention relationship is judged not to be the common user, deleting according to a second cache deleting logic and generating a second canceling result.
Optionally, the method for caching the concern relationship further includes:
receiving a request for inquiring the attention relationship; the query concern relation request comprises a third target concern relation needing to be queried;
judging whether the user in the third target attention relationship is a common user or not;
if the user in the third target attention relationship is judged to be a common user, inquiring according to a first inquiry logic to obtain a first inquiry result;
and if the user in the third target attention relationship is judged not to be the common user, inquiring according to a second inquiry logic to obtain a second inquiry result.
Optionally, the method for caching the concern relationship further includes:
acquiring a fourth target attention relation with the changed attention relation in the cache at preset time intervals;
judging whether the fourth target concern relationship is a newly increased concern relationship or not according to each fourth target concern relationship;
if the fourth target concern relationship is judged to be a newly-added concern relationship, judging whether the fourth target concern relationship exists in a database or not, and judging whether the updating time is the same as that of the cache or not;
if the fourth target attention relation does not exist in the database and/or the updating time is different from the cache, generating a first compensation result; wherein the first compensation result indicates the presence of an anomaly;
if the fourth target concern relationship exists in the database and the updating time is the same as the cache, judging whether the user in the fourth target concern relationship is a common user;
if the user in the fourth target attention relationship is judged to be a common user, processing according to a common user cache adding mode, and generating a second compensation result; wherein the second compensation result indicates that compensation is complete;
if the user in the fourth target attention relationship is judged not to be the common user, processing according to a high-level user cache adding mode, and generating a second compensation result;
if the fourth target concern relationship is judged not to be the newly increased concern relationship, judging whether a record of the fourth target concern relationship exists in a database or not, and judging whether the updating time is the same as the cache or not;
if the existence record of the fourth target attention relation does not exist in the database and/or the updating time is different from the cache, generating a first compensation result; wherein the first compensation result indicates the presence of an anomaly;
if the existence record of the fourth target attention relationship exists in the database and the updating time is the same as the cache, judging whether the user in the fourth target attention relationship record is a common user;
if the user in the existing record of the fourth target attention relationship is judged to be a common user, processing according to a common user cache deletion mode, and generating a second compensation result; wherein the second compensation result indicates that compensation is complete;
and if the user in the existence record of the fourth target attention relationship is judged not to be the common user, processing according to a high-level user cache deletion mode, and generating a second compensation result.
A second aspect of the present application provides a device for caching attention relationships, including:
a first receiving unit, configured to receive a new concern request; the newly-added concern relation request comprises a first target concern relation needing to be newly added;
the first judging unit is used for judging whether the effective first target concern relationship exists in a database or not;
a second judging unit, configured to judge whether a record of existence of the first target attention relationship exists in a database if the first judging unit judges that the first target attention relationship does not exist in the database;
a first generating unit, configured to generate a new record of the first target attention relationship if the second determining unit determines that the database does not have the existing record of the first target attention relationship;
a first modifying unit, configured to modify the existence record of the first target attention relationship if the second determining unit determines that the existence record of the first target attention relationship exists in the database;
a third judging unit, configured to judge whether a user in the first target attention relationship is a user in a high-level user group;
a cache unit, configured to store the first target attention relationship in a high-level user cache and generate a first cache result if the third determining unit determines that the user in the first target attention relationship is a user in a high-level user group; wherein the first cache result indicates that the first target concern relationship is successfully added;
a fourth judging unit, configured to judge whether the user in the first target attention relationship meets a standard of a senior user if the third judging unit judges that the user in the first target attention relationship is not a user in a senior user group;
the cache unit is further configured to, if the fourth determination unit determines that the user in the first target attention relationship meets the criteria of a senior user, upgrade the user in the first target attention relationship into a senior user, store the first target attention relationship in a senior user cache, and generate a first cache result;
the cache unit is further configured to store the first target attention relationship in a cache of a general user and generate a first cache result if the fourth determination unit determines that the user in the first target attention relationship does not meet the standard of the senior user.
Optionally, the apparatus for caching the concern relationship further includes:
the second generating unit is used for generating a second cache result if the first judging unit judges that the effective first target concern relationship exists in the database; and the second cache result shows that the first target concern relationship already exists in the current database, and caching is not required to be carried out again.
Optionally, the apparatus for caching the concern relationship further includes:
a second receiving unit, configured to receive a request to cancel the attention relationship; wherein the request for canceling attention relationship comprises a second target attention relationship which needs to be canceled;
a fifth judging unit, configured to judge whether there is an effective second target attention relationship in a database;
a third generating unit, configured to generate a first cancellation result if the fifth determining unit determines that the effective second target attention relationship does not exist in the database; the first cancellation result is used for indicating that the second target concern relationship does not exist in the database and the cancellation operation cannot be carried out;
a second modifying unit, configured to modify a record of existence of the second target attention relationship if the fifth determining unit determines that the effective second target attention relationship exists in the database;
a sixth judging unit, configured to judge whether a user in the second target attention relationship is a normal user;
a fourth generating unit, configured to delete the user in the second target attention relationship according to the first cache deletion logic and generate a second cancellation result if the sixth determining unit determines that the user is a normal user; wherein the second cancellation result indicates that the second target attention relationship is successfully cancelled;
the fourth generating unit is further configured to delete the user in the second target attention relationship according to a second cache deletion logic and generate a second cancellation result if the sixth determining unit determines that the user is not an ordinary user.
Optionally, the apparatus for caching the concern relationship further includes:
a third receiving unit, configured to receive a request for querying the attention relationship; the query concern relation request comprises a third target concern relation needing to be queried;
a seventh judging unit, configured to judge whether a user in the third target attention relationship is a normal user;
the query unit is configured to query according to a first query logic to obtain a first query result if the seventh determination unit determines that the user in the third target attention relationship is a common user;
the query unit is further configured to perform a query according to a second query logic to obtain a second query result if the seventh determination unit determines that the user in the third target attention relationship is not an ordinary user.
Optionally, the apparatus for caching the concern relationship further includes:
the acquisition unit is used for acquiring a fourth target attention relation with a changed attention relation in the cache at intervals of preset time;
an eighth determining unit, configured to determine, for each fourth target attention relationship, whether the fourth target attention relationship is a newly added attention relationship;
a ninth determining unit, configured to determine whether the fourth target attention relationship exists in the database and the update time is the same as the cache if the eighth determining unit determines that the fourth target attention relationship is the new added attention relationship;
a fifth generating unit, configured to generate a first compensation result if the ninth determining unit determines that the fourth target attention relationship does not exist in the database and/or the update time is different from the cache; wherein the first compensation result indicates the presence of an anomaly;
a tenth determining unit, configured to determine whether a user in the fourth target attention relationship is a normal user if the ninth determining unit determines that the fourth target attention relationship exists in the database and the update time is the same as the cache;
a sixth generating unit, configured to, if the tenth determining unit determines that the user in the fourth target attention relationship is a normal user, perform processing according to a normal user cache adding manner, and generate a second compensation result; wherein the second compensation result indicates that compensation is complete;
the sixth generating unit is further configured to, if the tenth determining unit determines that the user in the fourth target attention relationship is not an ordinary user, perform processing according to a high-level user cache adding manner, and generate a second compensation result;
an eleventh judging unit, configured to, if the eighth judging unit judges that the fourth target attention relationship is not the newly added attention relationship, judge whether a record of the fourth target attention relationship exists in a database, and whether the update time is the same as the cache;
the fifth generating unit is further configured to generate a first compensation result if the eleventh determining unit determines that the fourth target attention relationship record does not exist in the database and/or the update time is different from the cache; wherein the first compensation result indicates the presence of an anomaly;
a twelfth judging unit, configured to judge whether a user in the fourth target attention relationship record is a normal user if the eleventh judging unit judges that the fourth target attention relationship record exists in the database and the update time is the same as the cache;
the sixth generating unit is further configured to, if the twelfth judging unit judges that the user in the fourth target attention relationship record is a normal user, perform processing according to a normal user cache deletion mode, and generate a second compensation result;
the sixth generating unit is further configured to, if the twelfth judging unit judges that the user in the fourth target attention relationship record is not an ordinary user, perform processing according to a high-level user cache deletion mode, and generate a second compensation result.
A third aspect of the present application provides an electronic device comprising:
one or more processors;
a storage device having one or more programs stored thereon;
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement a method of caching concerns in accordance with any one of the first aspects.
A fourth aspect of the present application provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a method for caching relationships of interest as set forth in any one of the first aspects.
In view of the foregoing, the present application provides a method, an apparatus, an electronic device, and a computer storage medium for caching an attention relationship, where the method for caching the attention relationship includes: firstly, receiving a request for newly adding an attention relationship; the newly-added concern relation request comprises a first target concern relation needing to be newly added; then, judging whether the effective first target concern relationship exists in a database; if the first target concern relationship is judged not to exist in the database, judging whether a record of the first target concern relationship exists in the database or not; if the existence record of the first target concern relationship does not exist in the database, generating a new record of the first target concern relationship; if the existence record of the first target concern relationship exists in the database, modifying the existence record of the first target concern relationship; judging whether the user in the first target attention relationship is a user in an advanced user group or not; if the user in the first target concern relationship is judged to be a user in a high-level user group, storing the first target concern relationship into a high-level user cache, and generating a first cache result; wherein the first cache result indicates that the first target concern relationship is successfully added; if the user in the first target attention relationship is judged not to be a user in an advanced user group, judging whether the user in the first target attention relationship meets the standard of an advanced user or not; if the user in the first target concern relationship is judged to reach the standard of a high-level user, upgrading the user in the first target concern relationship into the high-level user, storing the first target concern relationship into a high-level user cache, and generating a first cache result; and if the user in the first target attention relationship is judged not to meet the standard of the advanced user, storing the first target attention relationship into a common user cache, and generating a first cache result. Therefore, the aim of effectively improving the caching efficiency is fulfilled.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a specific flowchart of a method for caching a concern relationship according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a method for caching concern relationships according to another embodiment of the present application;
fig. 3 is a flowchart of a method for caching concern relationships according to another embodiment of the present application;
fig. 4 is a flowchart of a method for caching concern relationships according to another embodiment of the present application;
fig. 5 is a schematic diagram of a relationship-of-interest caching apparatus according to another embodiment of the present application;
fig. 6 is a schematic view of an electronic device for implementing a method for caching attention relationships according to another embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first", "second", and the like, referred to in this application, are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence of functions performed by these devices, modules or units, but the terms "include", or any other variation thereof are intended to cover a non-exclusive inclusion, so that a process, method, article, or apparatus that includes a series of elements includes not only those elements but also other elements that are not explicitly listed, or includes elements inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiment of the application provides a method for caching a concern relationship, which specifically includes the following steps as shown in fig. 1:
s101, receiving a new concern relationship request.
The newly-added concern relation request comprises a first target concern relation needing to be newly added.
S102, judging whether the database has an effective first target concern relationship.
Specifically, if it is determined that the valid first target attention relationship exists in the database, step S103 is executed; if it is determined that the valid first target attention relationship does not exist in the database, step S104 is executed.
And S103, generating a second cache result.
And the second cache result shows that the first target concern relationship already exists in the current database, and caching is not required to be carried out again.
S104, judging whether a first target concern record exists in the database.
It should be noted that there may be a case where the user a pays attention to the user B but cancels the attention, and therefore, it is necessary to determine whether there is a record of existence of the first target attention relationship in the database.
Specifically, if it is determined that the database does not have a record of existence of the first target attention relationship, step S105 is executed; if it is determined that the database has the existence record of the first target attention relationship, step S106 is executed.
And S105, generating a newly-added record of the first target attention relationship.
And S106, modifying the existence record of the first target attention relationship.
S107, judging whether the user in the first target attention relationship is the user in the advanced user group.
Specifically, if it is determined that the user in the first target attention relationship is a user in the advanced user group, step S108 is executed; if it is determined that the user in the first target attention relationship is not a user in the advanced user group, step S109 is performed.
And S108, storing the first target attention relationship into a high-level user cache, and generating a first cache result.
And the first cache result shows that the first target concern relationship is successfully added.
Specifically, the manner of storing the first target attention relationship in the high-level user cache is as follows: and obtaining a key of the attention list by utilizing the Hash Tag logic of Redis according to the two users with the first target attention relationship, and storing the newly added logic in the Zset data format.
S109, judging whether the user in the first target attention relationship meets the standard of a high-level user.
In a specific implementation process of the present application, the manner of determining whether the user in the first target attention relationship meets the criteria of the advanced user may be, but is not limited to: and setting a focus number threshold, and upgrading the focus number of the user to a high-grade user if the focus number of the user reaches the threshold.
Specifically, if it is determined that the user in the first target attention relationship meets the criteria of the senior user, step S110 is executed; if it is determined that the user in the first target attention relationship does not meet the criteria of the advanced user, step S111 is performed.
S110, upgrading the users in the first target concern relationship into high-level users, storing the first target concern relationship into a high-level user cache, and generating a first cache result.
It should be noted that, the asynchronous processing logic is to upgrade the users in the first target attention relationship to the advanced users.
And S111, storing the first target attention relationship into a common user cache, and generating a first cache result.
Specifically, the way of storing the first target attention relationship in the common user cache is a newly added process in the Zset data format.
Optionally, in another embodiment of the present application, an implementation manner of the method for caching the attention relationship, as shown in fig. 2, further includes:
s201, receiving a request for canceling the concern relationship.
Wherein the request for canceling the attention relationship includes a second target attention relationship that needs to be canceled.
S202, judging whether the effective second target attention relationship exists in the database.
Specifically, if it is determined that there is no valid second target attention relationship in the database, step S203 is executed; if it is determined that the valid second target attention relationship exists in the database, step S204 is executed.
And S203, generating a first cancellation result.
And the first cancellation result is used for indicating that the second target concern relation does not exist in the database and the cancellation operation cannot be carried out.
And S204, modifying the existence record of the second target attention relationship.
S205, judging whether the user in the second target attention relationship is a common user.
Specifically, if it is determined that the user in the second target attention relationship is a normal user, step S206 is executed; if it is determined that the user in the second target attention relationship is not the normal user, step S207 is executed.
And S206, deleting according to the first cache deleting logic and generating a second canceling result.
Wherein the second cancellation result indicates that the second target attention relationship is successfully cancelled.
Specifically, the manner of deleting according to the first cache deletion logic is as follows: deletion processing of the Zset data format.
And S207, deleting according to the second cache deleting logic and generating a second canceling result.
Specifically, the manner of deleting according to the second cache deletion logic is as follows: and according to two users in the attention relationship, obtaining a key of the attention list by using the Hash Tag logic of Redis, and deleting the attention data in the Zset data format.
Optionally, in another embodiment of the present application, an implementation manner of the method for caching the attention relationship, as shown in fig. 3, further includes:
s301, receiving a request for inquiring the attention relationship.
Wherein, the query concern relation request comprises a third target concern relation to be queried.
S302, judging whether the user in the third target attention relationship is a common user.
Specifically, if it is determined that the user in the third target attention relationship is a normal user, step S303 is executed; if it is determined that the user in the third target attention relationship is not the normal user, step S304 is performed.
S303, inquiring according to the first inquiry logic to obtain a first inquiry result.
Specifically, the manner of performing query according to the first query logic is as follows: query processing in Zset data format.
S304, querying according to the second query logic to obtain a second query result.
Specifically, the manner of performing the query according to the second query logic is as follows: and obtaining a key of the attention list according to the referred user information and the fragment information, inquiring data, and returning the data to the calling party.
Optionally, in another embodiment of the present application, to ensure that data in a cache is consistent with data in a database, an implementation of the relationship-focused caching method, as shown in fig. 4, further includes:
s401, acquiring a fourth target attention relation with the changed attention relation in the cache at preset time intervals.
The preset time (e.g. 1 minute, 30 seconds, etc.) is preset and changed by a technician or a related authorized worker, and is not limited herein.
S402, judging whether the fourth target attention relation is a newly increased attention relation or not according to each fourth target attention relation.
Specifically, if it is determined that the fourth target attention relationship is the new attention relationship, step S403 is executed; if the fourth target attention relationship is determined not to be the new attention relationship, step S408 is executed.
S403, judging whether a fourth target attention relationship exists in the database or not, and whether the updating time is the same as the cache or not.
Specifically, if it is determined that the fourth target attention relationship does not exist in the database and/or the update time is different from the cache, step S404 is executed; if it is determined that the fourth target attention relationship exists in the database and the update time is the same as the cache, step S405 is executed.
S404, generating a first compensation result.
Wherein the first compensation result indicates the presence of an anomaly.
S405, judging whether the user in the fourth target attention relationship is a common user.
Specifically, if it is determined that the user in the fourth target attention relationship is a normal user, step S406 is executed; if it is determined that the user in the fourth target attention relationship is not the normal user, step S407 is executed.
And S406, processing according to the new adding mode of the common user cache, and generating a second compensation result.
Wherein the second compensation result indicates that the compensation is complete.
And S407, processing according to the new adding mode of the high-level user cache, and generating a second compensation result.
S408, judging whether the database has a record of the fourth target attention relationship and whether the updating time is the same as the cache.
Specifically, if it is determined that the database does not have a record of existence of the fourth target attention relationship, and/or the update time is different from the cache, step S404 is executed; if it is determined that the existence record of the fourth target attention relationship exists in the database and the update time is the same as the cache, step S409 is executed.
And S409, judging whether the user in the fourth target attention relationship record is a common user.
Specifically, if it is determined that the user in the existence record of the fourth target attention relationship is a normal user, step S410 is executed; if it is determined that the user in the existence record of the fourth target attention relationship is not the normal user, step S411 is executed.
And S410, processing according to a common user cache deletion mode, and generating a second compensation result.
Wherein the second compensation result indicates that the compensation is complete.
S411, processing according to a high-level user cache deleting mode, and generating a second compensation result.
According to the above scheme, the present application provides a method for caching attention relationships, including: firstly, receiving a request for newly adding an attention relationship; the newly-added concern relation request comprises a first target concern relation needing to be newly added; then, judging whether an effective first target concern relationship exists in the database; if the effective first target concern relationship does not exist in the database, judging whether a record of the first target concern relationship exists in the database or not; if the existence record of the first target concern relationship does not exist in the database, generating a new record of the first target concern relationship; if the existence record of the first target concern relationship exists in the database, modifying the existence record of the first target concern relationship; judging whether the user in the first target attention relationship is a user in a high-level user group; if the user in the first target concern relationship is judged to be a user in the advanced user group, storing the first target concern relationship into an advanced user cache, and generating a first cache result; the first cache result shows that the first target concern relationship is successfully added; if the user in the first target attention relationship is judged not to be the user in the advanced user group, judging whether the user in the first target attention relationship meets the standard of the advanced user or not; if the user in the first target concern relationship is judged to reach the standard of the senior user, upgrading the user in the first target concern relationship into the senior user, storing the first target concern relationship into a senior user cache, and generating a first cache result; and if the user in the first target attention relationship is judged not to meet the standard of the high-level user, storing the first target attention relationship into a common user cache, and generating a first cache result. Therefore, the aim of effectively improving the caching efficiency is fulfilled.
Optionally, in another embodiment of the present application, an implementation manner of a relationship-focused caching apparatus, as shown in fig. 5, includes:
afirst receiving unit 501, configured to receive a new interest relationship request.
The newly-added concern relation request comprises a first target concern relation needing to be newly added.
Afirst judging unit 502, configured to judge whether there is a valid first target attention relationship in the database.
Asecond judging unit 503, configured to judge whether there is a record of existence of the first target attention relationship in the database if thefirst judging unit 502 judges that there is no valid first target attention relationship in the database.
Afirst generating unit 504, configured to generate a new record of the first target attention relationship if the second determiningunit 503 determines that the existing record of the first target attention relationship does not exist in the database.
A first modifying unit 505, configured to modify the existence record of the first target attention relationship if the second determiningunit 503 determines that the existence record of the first target attention relationship exists in the database.
A third determiningunit 506, configured to determine whether the user in the first target attention relationship is a user in the advanced user group.
Acaching unit 507, configured to store the first target attention relationship in the high-level user cache and generate a first cache result if the third determiningunit 506 determines that the user in the first target attention relationship is a user in the high-level user group.
And the first cache result shows that the first target concern relationship is successfully added.
A fourth determiningunit 508, configured to determine whether the user in the first target attention relationship meets the criteria of the advanced user if the third determiningunit 506 determines that the user in the first target attention relationship is not a user in the advanced user group.
Thecaching unit 507 is further configured to, if the fourth determiningunit 508 determines that the user in the first target attention relationship meets the criteria of the senior user, upgrade the user in the first target attention relationship to a senior user, store the first target attention relationship in a senior user cache, and generate a first cache result.
Thecaching unit 507 is further configured to store the first target attention relationship in the common user cache and generate a first cache result if the fourth determiningunit 508 determines that the user in the first target attention relationship does not meet the criteria of the advanced user.
For a specific working process of the unit disclosed in the above embodiment of the present application, reference may be made to the content of the corresponding method embodiment, as shown in fig. 1, which is not described herein again.
Optionally, in another embodiment of the present application, an implementation manner of the relationship-focused caching apparatus further includes:
a second generating unit, configured to generate a second cache result if the first determiningunit 502 determines that the database has the valid first target attention relationship.
And the second cache result shows that the first target concern relationship already exists in the current database, and caching is not required to be carried out again.
For a specific working process of the unit disclosed in the above embodiment of the present application, reference may be made to the content of the corresponding method embodiment, as shown in fig. 1, which is not described herein again.
Optionally, in another embodiment of the present application, an implementation manner of the relationship-focused caching apparatus further includes:
and the second receiving unit is used for receiving a request for canceling the attention relationship.
Wherein the request for canceling the attention relationship includes a second target attention relationship that needs to be canceled.
And the fifth judging unit is used for judging whether the effective second target attention relation exists in the database.
And the third generating unit is used for generating a first canceling result if the fifth judging unit judges that the effective second target attention relation does not exist in the database.
And the first cancellation result is used for indicating that the second target concern relation does not exist in the database and the cancellation operation cannot be carried out.
And the second modifying unit is used for modifying the existence record of the second target concern relationship if the fifth judging unit judges that the effective second target concern relationship exists in the database.
A sixth judging unit, configured to judge whether the user in the second target attention relationship is an ordinary user.
And the fourth generating unit is used for deleting the user in the second target attention relationship according to the first cache deletion logic and generating a second cancellation result if the sixth judging unit judges that the user is the common user.
Wherein the second cancellation result indicates that the second target attention relationship is successfully cancelled.
And the fourth generating unit is further configured to delete the user in the second target attention relationship according to the second cache deletion logic and generate a second cancellation result if the sixth determining unit determines that the user is not an ordinary user.
For a specific working process of the unit disclosed in the above embodiment of the present application, reference may be made to the content of the corresponding method embodiment, as shown in fig. 2, which is not described herein again.
Optionally, in another embodiment of the present application, an implementation manner of the relationship-focused caching apparatus further includes:
and the third receiving unit is used for receiving a request for inquiring the attention relationship.
Wherein, the query concern relation request comprises a third target concern relation to be queried.
A seventh judging unit, configured to judge whether the user in the third target attention relationship is an ordinary user.
And the query unit is used for querying according to the first query logic to obtain a first query result if the seventh judgment unit judges that the user in the third target attention relationship is a common user.
And the query unit is further configured to perform query according to the second query logic to obtain a second query result if the seventh determination unit determines that the user in the third target attention relationship is not the common user.
For a specific working process of the unit disclosed in the above embodiment of the present application, reference may be made to the content of the corresponding method embodiment, as shown in fig. 3, which is not described herein again.
Optionally, in another embodiment of the present application, an implementation manner of the relationship-focused caching apparatus further includes:
and the obtaining unit is used for obtaining a fourth target attention relation with a changed attention relation in the cache at preset time intervals.
An eighth determining unit, configured to determine, for each fourth target attention relationship, whether the fourth target attention relationship is a newly added attention relationship.
A ninth determining unit, configured to determine whether the fourth target attention relationship exists in the database and the update time is the same as the cache if the eighth determining unit determines that the fourth target attention relationship is the new added attention relationship.
A fifth generating unit, configured to generate a first compensation result if the ninth determining unit determines that the fourth target attention relationship does not exist in the database and/or the update time is different from the cache; wherein the first compensation result indicates the presence of an anomaly.
A tenth determining unit, configured to determine whether the user in the fourth target attention relationship is a normal user if the ninth determining unit determines that the fourth target attention relationship exists in the database and the update time is the same as the cache.
And a sixth generating unit, configured to, if the tenth determining unit determines that the user in the fourth target attention relationship is an ordinary user, perform processing according to an ordinary user cache adding manner, and generate a second compensation result.
Wherein the second compensation result indicates that the compensation is complete.
And the sixth generating unit is further configured to, if the tenth determining unit determines that the user in the fourth target attention relationship is not the normal user, perform processing according to a high-level user cache adding manner, and generate a second compensation result.
An eleventh judging unit, configured to, if the eighth judging unit judges that the fourth target attention relationship is not the newly added attention relationship, judge whether a fourth target attention relationship record exists in the database, and whether the update time is the same as the cache.
The fifth generating unit is further configured to generate a first compensation result if the eleventh determining unit determines that the fourth target attention relationship record does not exist in the database and/or the update time is different from the cache.
Wherein the first compensation result indicates the presence of an anomaly.
A twelfth judging unit, configured to judge whether the user in the fourth target attention relationship record is an ordinary user if the eleventh judging unit judges that the fourth target attention relationship record exists in the database and the update time is the same as the cache.
And the sixth generating unit is further configured to, if the twelfth judging unit judges that the user in the fourth target attention relationship record is a normal user, perform processing according to a normal user cache deletion mode, and generate a second compensation result.
And the sixth generating unit is further configured to, if the twelfth judging unit judges that the user in the fourth target attention relationship record is not the normal user, perform processing according to a high-level user cache deletion mode, and generate a second compensation result.
For a specific working process of the unit disclosed in the above embodiment of the present application, reference may be made to the content of the corresponding method embodiment, as shown in fig. 4, which is not described herein again.
According to the above scheme, the present application provides a cache device for concern relationship: first, the first receiving unit 501 receives a new interest relationship request; the newly-added concern relation request comprises a first target concern relation needing to be newly added; then, the first judgment unit 502 judges whether there is an effective first target attention relationship in the database; if the first determining unit 502 determines that the database does not have an effective first target attention relationship, the second determining unit 503 determines whether a record of the first target attention relationship exists in the database; if the second determination unit 503 determines that there is no existing record of the first target attention relationship in the database, the first generation unit 504 generates an additional record of the first target attention relationship; if the second determination unit 503 determines that the database has an existence record of the first target attention relationship, the first modification unit 505 modifies the existence record of the first target attention relationship; the third determining unit 506 determines whether the user in the first target attention relationship is a user in the advanced user group; if the third determining unit 506 determines that the user in the first target attention relationship is a user in the advanced user group, the first target attention relationship is stored in the advanced user cache, and the cache unit 507 generates a first cache result; the first cache result shows that the first target concern relationship is successfully added; if the third determining unit 506 determines that the user in the first target attention relationship is not a user in the advanced user group, the fourth determining unit 508 determines whether the user in the first target attention relationship meets the criteria of the advanced user; if the fourth determining unit 508 determines that the user in the first target attention relationship meets the criteria of the senior user, the caching unit 507 upgrades the user in the first target attention relationship to the senior user, stores the first target attention relationship in a senior user cache, and generates a first cache result; if the fourth determining unit 508 determines that the user in the first target attention relationship does not meet the criteria of the senior user, the caching unit 507 stores the first target attention relationship in the normal user cache and generates a first cache result. Therefore, the aim of effectively improving the caching efficiency is fulfilled.
Another embodiment of the present application provides an electronic device, as shown in fig. 6, including:
one ormore processors 601.
Astorage device 602 having one or more programs stored thereon.
The one or more programs, when executed by the one ormore processors 601, cause the one ormore processors 601 to implement a method of caching relationships of interest as described in any of the above embodiments.
Another embodiment of the present application provides a computer storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method for caching the attention relationship as described in any one of the above embodiments.
In the above embodiments disclosed in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus and method embodiments described above are illustrative only, as the flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present disclosure may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part. The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a live broadcast device, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
Those skilled in the art can make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

CN202210161520.5A2022-02-222022-02-22Attention relationship caching method and device, electronic equipment and computer storage mediumActiveCN114218503B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN202210161520.5ACN114218503B (en)2022-02-222022-02-22Attention relationship caching method and device, electronic equipment and computer storage medium

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN202210161520.5ACN114218503B (en)2022-02-222022-02-22Attention relationship caching method and device, electronic equipment and computer storage medium

Publications (2)

Publication NumberPublication Date
CN114218503Atrue CN114218503A (en)2022-03-22
CN114218503B CN114218503B (en)2022-05-27

Family

ID=80709244

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN202210161520.5AActiveCN114218503B (en)2022-02-222022-02-22Attention relationship caching method and device, electronic equipment and computer storage medium

Country Status (1)

CountryLink
CN (1)CN114218503B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106502921A (en)*2016-10-252017-03-15电子科技大学A kind of new dynamic queue's caching method of social networkies based on user activity
CN109977129A (en)*2019-03-282019-07-05中国联合网络通信集团有限公司Multi-stage data caching method and equipment
CN110019552A (en)*2017-12-212019-07-16北京京东尚科信息技术有限公司User pays close attention to the method and apparatus that state updates
CN112579905A (en)*2020-12-252021-03-30百果园技术(新加坡)有限公司Message push object determining method, device, equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106502921A (en)*2016-10-252017-03-15电子科技大学A kind of new dynamic queue's caching method of social networkies based on user activity
CN110019552A (en)*2017-12-212019-07-16北京京东尚科信息技术有限公司User pays close attention to the method and apparatus that state updates
CN109977129A (en)*2019-03-282019-07-05中国联合网络通信集团有限公司Multi-stage data caching method and equipment
CN112579905A (en)*2020-12-252021-03-30百果园技术(新加坡)有限公司Message push object determining method, device, equipment and storage medium

Also Published As

Publication numberPublication date
CN114218503B (en)2022-05-27

Similar Documents

PublicationPublication DateTitle
KR101280346B1 (en)Method and device for terminal device management based on right control
US8839440B2 (en)Apparatus and method for forecasting security threat level of network
CN108924821B (en)Method for managing application independent of operator and eUICC card thereof
JP2009535626A5 (en)
CN104267982A (en)Application program start control system and method
CN104021141A (en)Method, device and system for data processing and cloud service
CN111400355B (en)Data query method and device
CN108288001B (en)Method and device for constructing organization architecture
US8554889B2 (en)Method, system and apparatus for managing computer identity
CN112445805A (en)Data query method and device
CN113590264A (en)File tamper-proofing method and device under container environment
CN114218503B (en)Attention relationship caching method and device, electronic equipment and computer storage medium
KR101003095B1 (en) Access Control Method and System for Multiple Access Objects
CN111695124A (en)Authority control method and device, storage medium and electronic equipment
CN109670339B (en)Ontology-based privacy protection-oriented access control method and device
CN109219051B (en)False number determination method, device, equipment and readable storage medium
CN113032471B (en)Database processing method and device, electronic equipment and medium
CN111143311B (en)Inter-application association determination and log association search methods, devices, media and equipment
US6983486B1 (en)Method and apparatus for establishing security scanner attributes in a computer system
CN113407960A (en)Data protection method, device and equipment for object storage and readable storage medium
CN111611555B (en)Physical layer authorization and access method and device
CN104573519B (en)file scanning method and system
CN112837019A (en) Method, device and device for pushing express track data
CN110990611A (en)Picture caching method and device, electronic equipment and storage medium
CN109740338B (en)Method and device for creating permission space and computer-readable storage medium

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp