Disclosure of Invention
The disclosure provides a comment information display method, a comment information display device, a server, a terminal, a computer-readable storage medium and a computer program product, which are used for at least solving the problem that a comment information display page of a client in the related art is broken. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a comment information display method, including:
receiving a comment acquisition request sent by a target account to a target work displayed on a client; responding to the comment acquisition request, acquiring candidate comment information from a plurality of caches corresponding to display permissions, wherein a plurality of comment information under the display permissions are cached in the caches corresponding to the display permissions, and the display permissions are used for expressing the visibility level of the comment information to the target account; obtaining comment information to be displayed, which is visible for the target account, from the candidate comment information according to the display permission of the candidate comment information; and sending the comment information to be displayed to the client, wherein the client is used for displaying the comment information to be displayed.
In one embodiment, the obtaining candidate comment information from a plurality of caches corresponding to the presentation authority in response to the comment obtaining request includes: obtaining the number of comments to be obtained corresponding to each cache according to the comment obtaining request; and obtaining the candidate comment information of the number of the comments to be obtained from each cache.
In one embodiment, the obtaining, according to the display permission of the candidate comment information, comment information to be displayed, which is visible to the target account, from the candidate comment information includes: sorting the candidate comment information according to a preset sorting sequence; and obtaining the comment information to be displayed, which is visible for the target account, from the sorted candidate comment information according to the display permission of the candidate comment information.
In one embodiment, the method further comprises: acquiring target comment information of the target account for the target work and display permission of the target comment information on other accounts except the target account; and caching the target comment information into a cache corresponding to the display permission of the target comment information.
In one embodiment, the method further comprises: storing the target comment information into a database corresponding to the display authority of the target comment information, wherein the database corresponding to the display authority is used for storing the full comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the method further comprises: acquiring a display authority change request of comment information, wherein the display authority change request carries the changed display authority of the comment information; and in response to the display permission change request, deleting the comment information from the cache corresponding to the display permission before the change, and updating the comment information to the cache corresponding to the display permission after the change.
In one embodiment, the method further comprises: in response to the display permission changing request, deleting the comment information from a database corresponding to the display permission before changing, and storing the comment information in a database corresponding to the display permission after changing; the database corresponding to the display authority is used for storing the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the display permission comprises a limitation display permission, and the limitation display permission is used for representing that comment information is not visible to the target account; the method further comprises the following steps: obtaining latest comment information from a database corresponding to the display limit authority at regular time, wherein the latest comment information is determined according to the release time of the comment information; and updating the latest comment information to a cache corresponding to the limited display permission.
According to a second aspect of the embodiments of the present disclosure, there is provided a comment information display method, including:
responding to comment display operation on a target work, sending a comment acquisition request to a server, wherein the comment acquisition request is used for requesting the server to obtain candidate comment information from a plurality of caches corresponding to display permissions, and obtaining comment information to be displayed visible for a target account from the candidate comment information according to the display permissions of the candidate comment information, wherein: a plurality of comment information under the display permission are cached in the cache corresponding to the display permission, and the display permission is used for expressing the visibility level of the comment information to the target account; receiving the comment information to be displayed sent by the server; and displaying the comment information to be displayed.
In one embodiment, the method further comprises: acquiring target comment information of the target account for the target work and display permission of the target comment information on other accounts except the target account; and sending the target comment information and the display permission of the target comment information to the server, wherein the server is used for caching the target comment information into a cache corresponding to the display permission of the target comment information.
In one embodiment, the server is further configured to store the target comment information in a database corresponding to a display authority of the target comment information, where the database corresponding to the display authority is used to store full comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the obtaining of the target comment information of the target account for the target work and the display permission of the target comment information includes: acquiring the target comment information; and responding to the display authority configuration operation of the target comment information, and acquiring the display authority of the target comment information.
In one embodiment, the method further comprises: responding to the display permission changing operation of the target comment information, and acquiring the changed display permission of the target comment information; sending a display permission change request to the server, wherein the display permission change request is used for requesting the server to delete the target comment information from the cache corresponding to the display permission before change, and update the target comment information to the cache corresponding to the display permission after change.
In one embodiment, the display permission change request is further configured to request the server to delete the target comment information from the database corresponding to the display permission before the change, and store the target comment information in the database corresponding to the display permission after the change;
the database corresponding to the display authority is used for storing the full amount of comment information under the display authority;
and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
According to a third aspect of the embodiments of the present disclosure, there is provided a comment information presentation apparatus including:
the receiving module is configured to execute receiving of a comment acquisition request sent by a target account to a target work displayed on a client;
a first obtaining module configured to perform, in response to the comment obtaining request, obtaining candidate comment information from a plurality of caches corresponding to display permissions, where a plurality of comment information under the display permissions are cached in the cache corresponding to the display permissions, and the display permissions are used for representing visibility levels of the comment information to the target account;
a comment determining module configured to execute obtaining comment information to be displayed visible for the target account from the candidate comment information according to the display permission of the candidate comment information
The sending module is configured to send the comment information to be displayed to the client, and the client is used for displaying the comment information to be displayed.
In one embodiment, the first obtaining module includes:
the first obtaining unit is configured to obtain the number of the comments to be obtained corresponding to each cache according to the comment obtaining request;
and the second acquisition unit is configured to acquire the candidate comment information of the number of the comments to be acquired from each cache.
In one embodiment, the comment determining module includes:
the ranking unit is configured to rank the candidate comment information according to a preset ranking order;
and the screening unit is configured to execute displaying permission according to the candidate comment information and obtain the comment information to be displayed, which is visible for the target account, from the sorted candidate comment information.
In one embodiment, the apparatus further comprises:
the second acquisition module is configured to execute acquisition of target comment information of the target account for the target work and display permission of the target comment information on other accounts except the target account;
the cache module is configured to cache the target comment information into a cache corresponding to the display permission of the target comment information.
In one embodiment, the apparatus further comprises:
the storage module is configured to store the target comment information into a database corresponding to the display authority of the target comment information, and the database corresponding to the display authority is used for storing the full comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the apparatus further comprises:
the third acquisition module is configured to execute a display permission change request for acquiring the comment information, wherein the display permission change request carries the changed display permission of the comment information;
and the first cache updating module is configured to execute responding to the display permission change request, delete the comment information from the cache corresponding to the display permission before the change, and update the comment information to the cache corresponding to the display permission after the change.
In one embodiment, the apparatus further comprises:
a database updating module configured to execute, in response to the display right change request, deleting the comment information from the database corresponding to the display right before the change, and storing the comment information in the database corresponding to the display right after the change; the database corresponding to the display authority is used for storing the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the display permission comprises a limitation display permission, and the limitation display permission is used for representing that comment information is not visible to the target account; the device further comprises:
the timing acquisition module is configured to execute timing acquisition of latest comment information from a database corresponding to the limited display permission, and the latest comment information is determined according to the release time of the comment information;
and the second cache updating module is configured to update the latest comment information to the cache corresponding to the limited display permission.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a comment information presentation apparatus including:
the sending module is configured to execute a comment display operation responding to a target work, send a comment acquisition request to a server, wherein the comment acquisition request is used for requesting the server to obtain candidate comment information from a plurality of caches corresponding to display permissions, and obtain comment information to be displayed visible in a target account from the candidate comment information according to the display permissions of the candidate comment information, and the comment acquisition request comprises:
a plurality of comment information under the display permission are cached in the cache corresponding to the display permission, and the display permission is used for expressing the visibility level of the comment information to the target account;
the receiving module is configured to execute receiving of the comment information to be shown sent by the server;
and the display module is configured to display the comment information to be displayed.
In one embodiment, the apparatus further comprises: the acquisition module is configured to execute acquisition of target comment information of the target account for the target work and display permission of the target comment information on other accounts except the target account;
the sending module is further configured to send the target comment information and the display permission of the target comment information to the server, and the server is used for caching the target comment information in a cache corresponding to the display permission of the target comment information.
In one embodiment, the server is further configured to store the target comment information in a database corresponding to a display authority of the target comment information, where the database corresponding to the display authority is used to store full comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
In one embodiment, the obtaining module is configured to perform obtaining the target comment information; and responding to the display authority configuration operation of the target comment information, and acquiring the display authority of the target comment information.
In one embodiment, the obtaining module is further configured to execute a display permission changing operation in response to the target comment information, and obtain the changed display permission of the target comment information;
the sending module is further configured to execute sending of a display permission change request to the server, where the display permission change request is used for requesting the server to delete the target comment information from the cache corresponding to the display permission before the change, and update the target comment information to the cache corresponding to the display permission after the change.
In one embodiment, the display permission change request is further configured to request the server to delete the target comment information from the database corresponding to the display permission before the change, and store the target comment information in the database corresponding to the display permission after the change; the database corresponding to the display authority is used for storing the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority through caching.
According to a fifth aspect of embodiments of the present disclosure, there is provided a server including:
a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the comment information presentation method as described in any one of the embodiments of the first aspect.
According to a sixth aspect of the embodiments of the present disclosure, there is provided a terminal, including:
a processor; a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the comment information presentation method according to any one of the embodiments of the second aspect.
According to a seventh aspect of the embodiments of the present disclosure, there is provided a comment information presentation system including the server according to the fifth aspect, and the terminal according to the sixth aspect.
According to an eighth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions of the computer-readable storage medium, when executed by a processor of a server, enable the server to execute the comment information presentation method as described in any one of the embodiments of the first aspect.
According to a ninth aspect of the embodiments of the present disclosure, there is provided a computer-readable storage medium, wherein instructions of the computer-readable storage medium, when executed by a processor of a terminal, enable the terminal to perform the comment information presentation method as described in any one of the embodiments of the second aspect.
According to a tenth aspect of the embodiments of the present disclosure, there is provided a computer program product, including a computer program, which when executed by a processor implements the comment information presentation method described in any one of the embodiments of the first aspect.
According to an eleventh aspect of the embodiments of the present disclosure, there is provided a computer program product, including a computer program, which when executed by a processor implements the comment information presentation method described in any one of the embodiments of the second aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
and configuring a cache corresponding to the display permission, wherein the display permission is used for expressing the visibility level of the comment information to the target account, and the comment information is respectively independent according to the display permission of the comment information. After the server receives a comment acquisition request sent by a target account to a target work displayed on the client, the server can acquire enough comment information to be displayed, which is visible to the target account, from a plurality of caches corresponding to display permissions within limited times, so that comment information acquisition efficiency is guaranteed, the request times of the comment information are reduced, and the phenomenon that a comment information display page of the client is broken is avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The comment information display method provided by the disclosure can be applied to the application environment shown in fig. 1. Wherein the terminal 110 interacts with the server 120 through the network. The terminal 110 has an application installed therein, and the application may be a social type application, an instant messaging type application, a short video type application, or the like. The user can check the works in the application program, check the comment information aiming at the works, issue the comment information, change the display permission of the comment information and the like through the application program. The server 120 may be pre-deployed with a database for storing the comment information and a plurality of caches corresponding to the display rights. The server 120 may update the comment information in each cache corresponding to the presentation authority according to the comment information in the database, so as to ensure consistency between the cache and the comment information in the database. When a user wants to view comment information of a target work displayed on the terminal 110, a comment display operation on the target work can be triggered through the terminal 110. The terminal 110 sends a comment acquisition request to the server 120 in response to the comment presenting operation. The server 120 responds to the comment acquisition request, and acquires candidate comment information from a plurality of caches corresponding to the display permission; and obtaining the comment information to be displayed, which is visible for the target account, from the candidate comment information according to the display permission of the candidate comment information. The server 120 sends the comment information to be shown to the terminal 110, so that the terminal 110 shows the comment information to be shown on the page. The terminal 110 may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 120 may be implemented by an independent server or a server cluster formed by a plurality of servers.
Fig. 2 is a flowchart illustrating a comment information presentation method according to an exemplary embodiment, where the comment information presentation method is used in a server, as shown in fig. 2, and includes the following steps.
In step S210, a comment acquisition request sent by a target account for a target work displayed on a client is received.
Wherein, the target account may refer to an account that is requesting comment information. A work may refer to digitally transmittable content including pictures, text, sound, video, animation, games, web pages, and the like.
The comment acquisition request can be sent by the client to the server in response to a comment presentation operation. The comment displaying operation may be an operation triggered by the user for the target work, and is not limited to a single-click operation, a double-click operation, a sliding operation, a gesture operation, an operation on a preset comment displaying control, and the like.
In step S220, in response to the comment acquisition request, candidate comment information is acquired from a plurality of caches corresponding to the display permission, a plurality of comment information under the display permission are cached in the cache corresponding to the display permission, and the display permission is used for representing the visibility level of the comment information to the target account.
The cache, i.e. the cache database, may be a non-relational database. In order to prevent the access amount of the relational database from being large and accelerate the loading speed of the comment information, in this embodiment, a corresponding cache is set for each display authority in advance, and is used for temporarily storing a plurality of comment information under the display authority. The cache may adopt a Key-Value cache, a document type cache, etc.
The presentation permissions may be used to represent a level of visibility of the review information to the target account, e.g., may be all users visible, some users visible (e.g., friends visible), only the review author visible, etc.
Specifically, after receiving a comment acquisition request for a target work, the server acquires a certain amount of candidate comment information from each cache corresponding to the exhibition permission according to work related information (e.g., a work name, a work identification, and the like of the target work) of the target work. The number of the comment information acquired from each cache corresponding to the display authority can be configured in advance or obtained through algorithm statistical analysis.
In step S230, the comment information to be displayed, which is visible in the target account, is obtained from the candidate comment information according to the display authority of the candidate comment information.
In step S240, the comment information to be displayed is sent to the client, where the client is used to display the comment information to be displayed.
Specifically, since the candidate comment information is obtained from a plurality of caches corresponding to the presentation authority, there may be comment information that is not visible to the target account. Therefore, the server can obtain the comment information to be displayed, which is visible for the target account, from the candidate comment information according to the display authority of the candidate comment information. And the server sends the comment information to be displayed to the client so that the client displays the comment information to be displayed on the current page.
In the comment information display method, the cache corresponding to the display authority is configured, the display authority is used for expressing the visibility level of the comment information to the target account, and the comment information is respectively independent according to the display authority of the comment information. After the server receives a comment acquisition request sent by a target account to a target work displayed on the client, the server can acquire enough comment information to be displayed, which is visible to the target account, from a plurality of caches corresponding to display permissions within limited times, so that comment information acquisition efficiency is guaranteed, the request times of the comment information are reduced, and the phenomenon that a comment information display page of the client is broken is avoided.
In an exemplary embodiment, step S220, in response to the comment acquisition request, acquires candidate comment information from a plurality of caches corresponding to the presentation authority, including: obtaining the number of comments to be obtained corresponding to each cache according to the comment obtaining request; and obtaining candidate comment information of the number of comments to be obtained from each cache.
The comment information may include a unique comment identifier and corresponding comment content. The comment content is not limited to pictures, text, sound, video, and the like. The cache of the server may correspondingly include an index cache storing comment identifications and a content cache storing comment content. The number of the comments to be acquired in each cache can be a preset constant, and the constant can be obtained by analyzing historical data; or the historical data can be analyzed through a pre-deployed analysis algorithm. The history data may be the history number of the comment identifiers obtained by the server from each index cache, and the corresponding comment loading times and comment loading results.
Illustratively, if the presentation rights include all user visibility and only comment author visibility. The method comprises the steps that a client is configured in advance to request M pieces of comment information to be displayed from a server each time. In the related technology, the server acquires M + S pieces of comment information from the cache (S is the number of comments which are taken more and is used for reducing the occurrence of the condition that one request is insufficient for M pieces of comment information caused by filtering), and filters the M + S pieces of comment information; if the number of the filtered comment information satisfies M, sending the filtered comment information to a client for display; and if the number of the filtered comment information is less than M, continuously acquiring M + S comment information from the cache until the number of the filtered comment information meets M. If the number of the filtered comment information does not reach M, the frequency of obtaining the comment information from the cache by the server reaches the upper limit of the frequency, and then the phenomenon that the display page of the comment information is broken occurs.
However, in this embodiment, the server may be configured to acquire M pieces of candidate comment information from the cache visible to all users each time, and acquire S pieces of candidate comment information from the cache visible to only the comment author, so that the server can acquire a sufficient amount of comment information to be displayed in a single time.
Specifically, after receiving the comment acquisition request, the server refers to the content and acquires the candidate comment identifiers of the number of comments to be acquired from each index cache corresponding to the display authority. And obtaining corresponding comment content from the content cache according to each candidate comment identification.
In some possible embodiments, before obtaining the comment content from the content cache, the server may filter the candidate comment identifier according to the display permission corresponding to the candidate comment identifier, so as to obtain the comment identifier to be displayed, which is visible to the target account.
Further, before the server filters the candidate comment identifiers, the obtained candidate comment identifiers may be sorted according to a preset sorting order, for example, the candidate comment identifiers are sorted according to comment publishing time corresponding to the candidate comment identifiers. And filtering the sorted candidate comment identifications to obtain the comment identifications to be displayed, which are visible in the target account.
Further, each time the client sends a comment acquisition request, a fixed amount of comment information to be presented may be requested from the server. Therefore, after filtering the candidate comment identifications, the server can select a fixed number of candidate comment identifications with latest release time from the filtered candidate comment identifications as the comment identifications to be displayed. And then obtaining the comment content to be displayed corresponding to the comment identification to be displayed from the content cache, and sending the comment content to be displayed to the client for displaying.
In this embodiment, by pre-deploying the index cache corresponding to each display permission, it can be ensured that the server can obtain a certain number of comment identifiers which can be displayed at the client from the multiple caches corresponding to the display permissions within a limited number of times, that is, the accuracy of the number of comment information can be ensured, and the success rate of obtaining comment information satisfying the preset number can be improved; the comment information obtained from different display authorities is sequenced according to a uniform sequencing rule, so that a user can obtain comments without perception.
In an exemplary embodiment, as shown in fig. 3, the method further comprises:
in step S310, target comment information of the target account for the target work and display permission of the target comment information for accounts other than the target account are acquired.
In step S320, the target comment information is cached in the cache corresponding to the display authority of the target comment information.
Specifically, if the user wants to issue comment information on the target work, comment content can be input through a comment input box of the client, and target comment information is generated. And the client acquires the display authority corresponding to the target comment information. The display authority can be pre-configured by the system, for example, the display authority of the comment information is configured to be visible for all users by default; the user may also configure the target comment information trigger display permission configuration operation, for example, when the user wants to cancel all the user visibilities, manual configuration may be additionally performed. And after receiving a comment issuing instruction of the target comment information, the client sends the target comment information and the corresponding display permission to the server. And the server caches the target comment information into a cache corresponding to the display permission by taking the target work as a dimension according to the display permission of the target comment information.
In this embodiment, the accuracy of the data in the cache can be ensured by updating the corresponding caches in real time according to the visibility levels of the comment information.
In an exemplary embodiment, the method further comprises: and storing the target comment information into a database corresponding to the display authority of the target comment information according to the display authority of the target comment information.
The database (MySQL, relational database management system) is a warehouse for organizing, storing and managing data according to a data structure, and is an organized, sharable, and uniformly managed collection of a large amount of data stored in a computer for a long time.
Specifically, the server may further deploy a plurality of databases corresponding to the display permissions, and the databases are used for storing the full amount of comment information under the corresponding display permissions for a long time. And the comment information in the cache can be cached by the server from a database with the same display authority. For example, presentation rights include full visibility and only author's own visibility. Then a database corresponding to all visible exhibition authorities can be separately deployed for storing all visible full amount of comment information for a long time; the database corresponding to the presentation authority visible only by the author can be deployed independently for the full amount of comment information visible only by the author for a long time. After the server receives the target comment information, the target comment information can be stored in a database corresponding to the display authority of the target comment information according to the display authority of the target comment information.
Further, the updating order of the database and the cache may be configured in advance, for example, after the server receives the target comment information, the target comment information is updated to the database corresponding to the display authority of the target comment information. And then, updating the cache corresponding to the display authority of the target comment information.
Further, in order to ensure the consistency of the cache and the database under the same exhibition authority, the invalidation time can be configured for each cache. And when the expiration time is reached, the server acquires a certain amount of newly issued comment information from the database and updates the acquired comment information into the cache corresponding to the same display authority.
In the embodiment, the comment information is separately stored according to the visibility level, so that the efficiency and the success rate of obtaining the comment information are ensured; the corresponding databases are respectively updated in real time according to the visibility levels of the comment information, so that the accuracy of the data in the databases can be ensured, and the comment information can be conveniently maintained and managed subsequently.
In an exemplary embodiment, as shown in fig. 4, the method further comprises:
in step S410, a display right change request of the comment information is obtained, and the display right after the change of the comment information is carried in the display right change request.
In step S420, in response to the presentation right change request, the comment information is deleted from the cache corresponding to the presentation right before the change, and the comment information is updated to the cache corresponding to the presentation right after the change.
The display permission change request can be sent by the client after responding to the display permission change operation triggered by the user to the comment information. The display permission changing operation can be a single-click operation, a double-click operation, a long-time pressing operation, an operation on a preset display permission changing control and the like on the comment information.
Specifically, the client may display the visibility level list in response to the display right changing operation, so that the user can select the changed display right from the visibility level list. The client acquires the changed display permission selected by the user and sends a display permission change request to the server. And after receiving the display permission change request, the server deletes the comment information from the cache corresponding to the display permission before the change, and updates the target comment information to the cache corresponding to the display permission after the change.
In this embodiment, after the display permission of the comment information is changed, the server updates the corresponding caches in real time according to the changed display permission, so that the accuracy of the data in the caches can be ensured.
In an exemplary embodiment, the method further comprises: and in response to the display permission change request, deleting the comment information from the database corresponding to the display permission before the change, and storing the comment information into the database corresponding to the display permission after the change.
Specifically, the server may further deploy a plurality of databases corresponding to the display permissions, and the databases are used for storing the full amount of comment information under the corresponding display permissions for a long time. And the comment information in the cache can be cached by the server from a database with the same display authority. After the server receives the display permission change request, the comment information can be deleted from the database corresponding to the display permission before the change according to the changed display permission carried in the display permission change request, and the target comment information is updated to the database corresponding to the changed display permission.
In this embodiment, after the display permission of the comment information is changed, the server updates the corresponding databases in real time according to the changed display permission, so that the accuracy of the data in the databases can be ensured.
In an exemplary embodiment, the presentation permissions include a limitation presentation permission, which may be used to represent that the comment information is not visible to the target account; the method further comprises the following steps: acquiring latest comment information from a database corresponding to the display permission limitation at regular time, wherein the latest comment information is determined according to the release time of the comment information; and updating the latest comment information to a cache corresponding to the limited display permission.
Wherein, limiting the exposure permissions may refer to other permissions than all user visibility levels, e.g., only comment authors are visible themselves. In general, the number of the comment information corresponding to the display authority is limited to be far less than the number of the comment information visible to all users. For the cache corresponding to the limited display permission, a cache updating strategy can be configured independently. In a specific implementation, the expiration time may be configured in advance for the cache corresponding to the display limit permission. And when the failure time is reached, the server clears the cache corresponding to the limited display authority. And acquiring a certain amount of latest comment information from the database corresponding to the limited display permission, and updating the acquired latest comment information into a corresponding cache.
Further, for the cache corresponding to the unlimited display permission, a back-source policy may be adopted to update the stored comment information. The back-to-source strategy is to acquire comment information to be distributed from a source station (database) if the comment information to be acquired does not exist in the cache.
In this embodiment, by separately deploying the cache updating policy for restricting the display permission, additional pressure is not brought to the server while the validity of data in the cache is ensured.
Fig. 5 is a flowchart illustrating a comment information presentation method according to an exemplary embodiment, where the comment information presentation method is used in a terminal, as shown in fig. 5, and includes the following steps.
In step S510, in response to a comment display operation on a target work, a comment acquisition request is sent to a server, where the comment acquisition request is used to request the server to obtain candidate comment information from multiple caches corresponding to display permissions, and obtain comment information to be displayed, which is visible in a target account, from the candidate comment information according to the display permissions of the candidate comment information, where: a plurality of comment information under the display authority are cached in the cache corresponding to the display authority, and the display authority is used for expressing the visibility level of the comment information to the target account.
In step S520, comment information to be presented sent by the server is received.
In step S530, comment information to be presented is presented.
Specifically, the comment acquisition request may be sent by the client to the server in response to a comment presentation operation. After receiving a comment acquisition request sent by a client, the server acquires a certain amount of candidate comment information from each cache corresponding to the display permission according to the work related information of the target work. The number of the comment information acquired from the cache corresponding to each display authority can be configured in advance, and can also be obtained through algorithm statistical analysis.
Since the candidate comment information is obtained from a plurality of caches corresponding to the presentation authority, there may be comment information that is not visible to the target account. Therefore, the comment information to be displayed, which is visible for the target account, can be obtained from the candidate comment information according to the display authority of the candidate comment information, referring to the above exemplary illustration of the server side. And the server sends the comment information to be displayed to the client.
After receiving the comment information to be displayed sent by the server, the client can render the comment information to be displayed on the page in a preset comment information display mode. The comment information display mode can be display at a preset position of a current page, display at a comment information display page, display through modes such as a pop-up window, a side bar and a pop-up screen.
In the comment information display method, the cache corresponding to the display authority is configured, the display authority is used for expressing the visibility level of the comment information to the target account, and the comment information is respectively independent according to the display authority of the comment information. After the server receives a comment acquisition request sent by a target account to a target work displayed on the client, the server can acquire enough comment information to be displayed, which is visible to the target account, from a plurality of caches corresponding to display permissions within limited times, so that comment information acquisition efficiency is guaranteed, the request times of the comment information are reduced, and the phenomenon that a comment information display page of the client is broken is avoided.
In an exemplary embodiment, the target account may publish comment information for the target work, as shown in fig. 6, which may be implemented by:
in step S610, target comment information of the target account for the target work and display permission of the target comment information for accounts other than the target account are acquired.
In step S620, the target comment information and the display permission of the target comment information are sent to a server, where the server is configured to cache the target comment information in a cache corresponding to the display permission of the target comment information.
Specifically, if the user wants to issue comment information on the target work, comment content can be input through a comment input box of the client, and target comment information is generated. And the client acquires the display authority corresponding to the target comment information. The display authority can be pre-configured by the system, for example, the display authority of the comment information is configured to be visible for all users by default; the user may also configure the target comment information trigger display permission configuration operation, for example, when the user wants to cancel all the user visibilities, manual configuration may be additionally performed. And after receiving a comment issuing instruction of the target comment information, the client sends the target comment information and the corresponding display permission to the server. And the server caches the target comment information into a cache corresponding to the display permission by taking the target work as a dimension according to the display permission of the target comment information. For example, if the display permission of the target comment information is that all users are visible, the server caches the target comment information in a cache corresponding to the permission that all users are visible; if the display permission of the target comment information is that only the comment author is visible, the server caches the comment information in a cache corresponding to the permission that only the comment author is visible.
In this embodiment, the accuracy of the data in the cache can be ensured by updating the corresponding caches in real time according to the visibility levels of the comment information.
In an exemplary embodiment, referring to the above exemplary description of the server, the target comment information is stored in the database corresponding to the display authority of the target comment information through the server. And are not specifically described herein.
In an exemplary embodiment, a change manner of the display authority of the target comment information is described. Responding to the display permission changing operation of the target comment information, and acquiring the display permission of the changed target comment information; and sending a display permission change request to the server, wherein the display permission change request is used for requesting the server to delete the target comment information from the cache corresponding to the display permission before the change, and updating the target comment information into the cache corresponding to the display permission after the change.
Specifically, the user may change the display authority of the comment information issued by himself, for example, change the original comment information that is only visible by the author himself to be visible by all users. The client can respond to the display permission changing operation triggered by the user to display the visibility level list so that the user can select the changed display permission from the visibility level list. The client acquires the changed display permission selected by the user, sends a display permission change request to the server, and the display permission change request carries the changed display permission. And the server deletes the target comment information from the cache corresponding to the display authority before the change according to the display authority change request, and updates the target comment information to the cache corresponding to the display authority after the change.
In this embodiment, after the display permission of the comment information is changed, the server updates the corresponding caches in real time according to the changed display permission, so that the accuracy of the data in the caches can be ensured.
In an exemplary embodiment, referring to the above exemplary description of the server, the server deletes the target comment information from the database corresponding to the exhibition permission before the change, and stores the target comment information in the database corresponding to the exhibition permission after the change. And are not specifically described herein.
Fig. 7 is an interaction flow diagram illustrating a review information presentation method according to an exemplary embodiment. The comment information display method is used in a comment information display system as shown in fig. 7, and the system comprises a terminal and a server. And a plurality of databases and caches corresponding to the display authorities are pre-deployed in the server. Presentation rights may include all user visibility and only comment author visibility, etc. As shown in fig. 7, the following steps are included.
In step S702, the terminal sends a comment acquisition request to the server in response to a comment presentation operation for the target work displayed on the client. The comment presentation operation may be a user clicking a "comment" button in the work presentation page, performing a slide-up operation on the comment information page, or the like.
In step S704, the server obtains the number of comments to be obtained corresponding to each index cache in response to the comment obtaining request, and obtains the candidate comment identifier of the number of comments to be obtained from each index cache.
Specifically, the manner of determining the number of the comments to be obtained may refer to the above-described embodiments, and is not specifically described herein. The cache may be a Redis cache. The Redis cache is an open-source log-type and Key-Value database which is written by using C language and can be based on memory and can also be persisted. The structural design of the Redis cache can be as follows:
Key:userID
Value:Map<photoID,List<Long>commentID>
wherein userID represents a comment author identification; the photo ID represents the identity of the work; the commenting id represents a comment identification.
In step S706, the server ranks the obtained candidate comment identifiers according to the publishing time of the comment information, and filters the ranked candidate comment identifiers to obtain the comment identifiers to be displayed, which are visible to the preset number of target accounts.
In step S708, the server obtains the comment content to be presented from the content cache according to the comment identifier to be presented.
In step S710, the server sends comment information to be presented to the terminal. The comment information to be displayed comprises a comment identifier to be displayed and comment content to be displayed corresponding to the comment identifier to be displayed.
In step S712, the terminal presents the comment information to be presented.
In step S714, the terminal obtains target comment information of the target account for the target work and display permission of the target comment information. The display authority can be pre-configured by the system, for example, the display authority of the comment information is configured to be visible for all users by default; the user may also configure the target comment information trigger presentation permission configuration operation, for example, when the user wants to set that only the comment author is visible, manual configuration may be additionally performed.
In step S716, the terminal sends the target comment information and the display authority of the target comment information to the server in response to the comment issuing instruction.
Specifically, after the terminal acquires the comment publishing instruction, the terminal can send the target comment information and the display permission of the target comment information to the Kafka message queue, so that the message task acquires the target comment information and the corresponding display permission from the Kafka message queue and sends the target comment information and the corresponding display permission to the server.
In step S718, the server updates the target comment to the database corresponding to the display authority of the target comment information.
In step S720, the server caches the target comment information in a cache corresponding to the display authority of the target comment information.
In step S722, the terminal displays the visibility level list in response to the display right changing operation for the target comment information, so that the user can select the changed display right from the visibility level list.
In step S724, the terminal transmits a presentation authority change request to the server. The display permission change request carries the changed display permission.
In step S726, the server deletes the target comment information from the database corresponding to the display authority before the change, and updates the target comment information to the database corresponding to the display authority after the change.
In step S728, the server deletes the target comment information from the cache corresponding to the exhibition permission before the change, and updates the target comment information to the cache corresponding to the exhibition permission after the change.
In step S730, the server updates the cache that is only visible to the author.
Specifically, the cache expiration time corresponding to the presentation right visible only to the author may be preconfigured. When the expiration time is reached, the server empties the corresponding cache visible to the author only. And acquiring a certain amount of latest comment information from the database which is only visible by the author and updating the acquired latest comment information into the corresponding cache.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a part of the steps in the above-mentioned flowcharts may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the steps or the stages is not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a part of the steps or the stages in other steps.
Fig. 8 is a block diagram illustrating a review information presentation apparatus 800 according to an exemplary embodiment. Referring to fig. 8, the apparatus includes a receiving module 802, a first obtaining module 804, a comment determining module 806, and a sending module 808.
A receiving module 802 configured to execute receiving a comment acquisition request sent by a target account for a target work displayed on a client; a first obtaining module 804, configured to perform, in response to the comment obtaining request, obtaining candidate comment information from a plurality of caches corresponding to the display permission, where a plurality of comment information under the display permission are cached in the cache corresponding to the display permission, and the display permission is used for representing a visibility level of the comment information to the target account; and the comment determining module 806 is configured to execute obtaining the comment information to be displayed, which is visible to the target account, from the candidate comment information according to the display permission of the candidate comment information. The sending module 808 is configured to send the comment information to be displayed to the client, where the client is used to display the comment information to be displayed.
In an exemplary embodiment, the first obtaining module 804 includes: the first obtaining unit is configured to obtain the number of the comments to be obtained corresponding to each cache according to the comment obtaining request; and the second acquisition unit is configured to acquire the candidate comment information of the number of the comments to be acquired from each cache.
In an exemplary embodiment, comment determination module 806 includes: the ranking unit is configured to rank the candidate comment information according to a preset ranking order; and the screening unit is configured to execute displaying permission according to the candidate comment information and obtain the comment information to be displayed, which is visible for the target account, from the sorted candidate comment information.
In an exemplary embodiment, the apparatus 800 further comprises: the second acquisition module is configured to execute acquisition of target comment information of the target account for the target work and display permission of the target comment information on other accounts except the target account; and the cache module is configured to cache the target comment information into a cache corresponding to the display permission of the target comment information.
In an exemplary embodiment, the apparatus 800 further comprises: the storage module is configured to store the target comment information into a database corresponding to the display authority of the target comment information, and the database corresponding to the display authority is used for storing the full comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority.
In an exemplary embodiment, the apparatus 800 further comprises: the third acquisition module is configured to execute a display permission change request for acquiring the comment information, and the display permission change request carries the changed display permission of the comment information; and the first cache updating module is configured to execute responding to the display permission change request, delete the comment information from the cache corresponding to the display permission before the change, and update the comment information to the cache corresponding to the display permission after the change.
In an exemplary embodiment, the apparatus 800 further comprises: the database updating module is configured to execute the steps of responding to the display permission changing request, deleting the comment information from the database corresponding to the display permission before changing, and storing the comment information into the database corresponding to the display permission after changing; the database corresponding to the display authority is used for storing the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority.
In an exemplary embodiment, the presentation authority includes a limitation presentation authority, and the limitation presentation authority is used for representing that the comment information is not visible to the target account; the apparatus 800 further comprises: the timing acquisition module is configured to execute timing acquisition of latest comment information from a database corresponding to the display permission limitation, and the latest comment information is determined according to the release time of the comment information; and the second cache updating module is configured to update the latest comment information to the cache corresponding to the limited display permission.
Fig. 9 is a block diagram illustrating a review information presentation apparatus 900 according to an exemplary embodiment. Referring to fig. 9, the apparatus includes a transmitting module 902, a receiving module 904, and a presenting module 906.
A sending module 902, configured to execute a comment display operation in response to a target work, send a comment acquisition request to a server, where the comment acquisition request is used to request the server to obtain candidate comment information from multiple caches corresponding to display permissions, and obtain comment information to be displayed, which is visible in a target account, from the candidate comment information according to the display permissions of the candidate comment information, where: a plurality of comment information under the display authority are cached in the cache corresponding to the display authority, and the display authority is used for expressing the visibility level of the comment information to the target account; a receiving module 904 configured to perform receiving comment information to be presented, which is sent by a server; and the presentation module 906 is configured to perform presentation of the comment information to be presented.
In an exemplary embodiment, the apparatus 900 further comprises: the acquisition module is configured to execute the acquisition of target comment information of a target account for a target work and the display permission of the target comment information on other accounts except the target account; the sending module 902 is further configured to send the target comment information and the display permission of the target comment information to a server, where the server is configured to cache the target comment information in a cache corresponding to the display permission of the target comment information.
In an exemplary embodiment, the server is further configured to store the target comment information in a database corresponding to the display authority of the target comment information, and the database corresponding to the display authority is used to store the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority.
In an exemplary embodiment, the obtaining module is configured to perform obtaining the target comment information; and responding to the display authority configuration operation of the target comment information, and acquiring the display authority of the target comment information.
In an exemplary embodiment, the obtaining module is further configured to execute a display permission changing operation in response to the target comment information, and obtain the changed display permission of the target comment information; the sending module 902 is further configured to execute sending, to the server, a display permission change request, where the display permission change request is used to request the server to delete the target comment information from the cache corresponding to the display permission before the change, and update the target comment information to the cache corresponding to the display permission after the change.
In an exemplary embodiment, the display permission change request is further used for requesting the server to delete the target comment information from the database corresponding to the display permission before the change, and store the target comment information in the database corresponding to the display permission after the change; the database corresponding to the display authority is used for storing the full amount of comment information under the display authority; and the comment information in the cache is obtained by the server from the database with the same display authority.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 10 is a block diagram illustrating an apparatus 1000 for review information presentation in accordance with an exemplary embodiment. For example, device 1000 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and like terminal devices.
Referring to fig. 10, device 1000 may include one or more of the following components: processing component 1002, memory 1004, power component 1006, multimedia component 1008, audio component 1010, interface to input/output (I/O) 1012, sensor component 1014, and communications component 1016.
The processing component 1002 generally controls the overall operation of the device 1000, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 1002 may include one or more processors 1020 to execute instructions to perform all or a portion of the steps of the methods described above. Further, processing component 1002 may include one or more modules that facilitate interaction between processing component 1002 and other components. For example, the processing component 1002 may include a multimedia module to facilitate interaction between the multimedia component 1008 and the processing component 1002.
The memory 1004 is configured to store various types of data to support operation at the device 1000. Examples of such data include instructions for any application or method operating on device 1000, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 1004 may be implemented by any type or combination of volatile or non-volatile storage devices, such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 1006 provides power to the various components of the device 1000. The power components 1006 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 1000.
The multimedia component 1008 includes a screen that provides an output interface between the device 1000 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1008 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 1000 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 1010 is configured to output and/or input audio signals. For example, the audio component 1010 may include a Microphone (MIC) configured to receive external audio signals when the device 1000 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 1004 or transmitted via the communication component 1016. In some embodiments, audio component 1010 also includes a speaker for outputting audio signals.
I/O interface 1012 provides an interface between processing component 1002 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 1014 includes one or more sensors for providing status assessment of various aspects of the device 1000. For example, sensor assembly 1014 may detect the open/closed status of device 1000, the relative positioning of components, such as a display and keypad of device 1000, the change in position of device 1000 or a component of device 1000, the presence or absence of user contact with device 1000, the orientation or acceleration/deceleration of device 1000, and the change in temperature of device 1000. The sensor assembly 1014 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 1014 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
Communications component 1016 is configured to facilitate communications between device 1000 and other devices in a wired or wireless manner. The device 1000 may access a wireless network based on a communication standard, such as WiFi, an operator network (such as 2G, 3G, 4G, or 5G), or a combination thereof. In an exemplary embodiment, the communication component 1016 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communications component 1016 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the device 1000 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 1004 comprising instructions, executable by the processor 1020 of the device 1000 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
FIG. 11 is a block diagram illustrating an apparatus 1100 for review information presentation in accordance with an exemplary embodiment. For example, device 1100 can be a server. Referring to fig. 11, device 1100 includes a processing component 1120 that further includes one or more processors, and memory resources, represented by memory 1122, for storing instructions, e.g., applications, that are executable by processing component 1120. The application programs stored in memory 1122 may include one or more modules that each correspond to a set of instructions. Further, processing component 1120 is configured to execute instructions to perform the method of XXX described above.
The device 1100 may also include a power component 1124 configured to perform power management of the device 1100, a wired or wireless network interface 1126 configured to connect the device 1100 to a network, and an input/output (I/O) interface 1128. The device 1100 may operate based on an operating system such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, or the like, stored in the memory 1122.
In an exemplary embodiment, a storage medium comprising instructions, such as memory 1122 comprising instructions, executable by a processor of device 1100 to perform the above-described method is also provided. The storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.