Like data query method and storage medium
By storing the like status and quantity in a distributed cache using the identifier of the liked object as the key and the identifier of the like object as the field, the problem of low query efficiency of like data in high-concurrency scenarios is solved, achieving efficient data reading and system scalability.
Patent Information
- Application Number
- CN202511076432.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-01
- Publication Date
- 2025-11-14
AI Technical Summary
In high-concurrency scenarios, the low efficiency of querying like data can lead to excessive database load, potentially causing response delays or even service crashes, increasing storage costs and system complexity.
By receiving the client's request to query like data, the query is performed using the like status list cache in the distributed cache. The cached data is stored with the like object identifier as the key, the like object identifier as the field, and the like status and like count as the values. The target like data is retrieved directly from the cache.
It improved query performance, reduced database pressure, achieved efficient data reading, reduced latency, and significantly improved query efficiency and system scalability.
Smart Images

Figure CN120950550A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a method for querying like data and a storage medium. Background Technology
[0002] As internet applications continue to expand and user interactions become more frequent, higher demands are being placed on the real-time performance of data access and system performance.
[0003] In related technologies, if the database is accessed directly every time a client queries the like status (such as "whether a user has liked a certain piece of content" or "the total number of likes for a certain piece of content"), it will lead to excessive database load, especially in high-concurrency scenarios (such as like queries for popular posts or trending news), which may cause response delays or even service crashes. In addition, frequent database read and write operations will also increase storage costs and system complexity. Summary of the Invention
[0004] This invention provides a method and storage medium for querying like data to solve the problem of low efficiency in querying like data in high-concurrency scenarios.
[0005] According to one aspect of the present invention, a method for querying like data is provided, comprising:
[0006] The system receives a query request from a client for like data of a liking object, determines the liking object identifier and the liking object identifier based on the query request, and performs a query based on the like status list cache in the distributed cache based on the like object identifier and the liking object identifier. The cached data in the like status list cache is stored with the liking object identifier as the key, the like object identifier as the field, and the like status and like count as the values.
[0007] If the identifier of the liked object and the identifier of the liked object are found in the cache of the like status list, the target like data is obtained from the cache of the like status list based on the identifier of the liked object and the identifier of the liked object, and the target like data is displayed to the client.
[0008] According to another aspect of the present invention, a like data query device is provided, comprising:
[0009] The query module is used to receive a query request from the client for the like data of the like object, determine the like object identifier and the liked object identifier based on the like data query request, and perform a query based on the like object identifier and the liked object identifier in the like status list cache in the distributed cache; the cached data in the like status list cache is stored with the liked object identifier as the key, the like object identifier as the field, and the like status and like count as the value.
[0010] The acquisition and display module is used to retrieve target like data from the like status list cache based on the like object identifier and the liked object identifier when the like object identifier and the liked object identifier are found in the like status list cache, and then display the target like data to the client.
[0011] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0012] At least one processor; and
[0013] A memory communicatively connected to the at least one processor; wherein,
[0014] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the like data query method according to any embodiment of the present invention.
[0015] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the like data query method according to any embodiment of the present invention.
[0016] The technical solution of this invention involves receiving a client's query request for like data of a target object, determining the identifier of the target object and the identifier of the object being liked based on the query request, and querying the like status list cache in a distributed cache based on the identifier of the target object and the identifier of the object being liked. Since the cached data in the like status list cache uses the identifier of the object being liked as the key, the identifier of the target object as the field, and the like status and number of likes as values, query performance is improved and database pressure is reduced. Then, if the identifier of the target object and the identifier of the object being liked are found in the like status list cache, the target like data is retrieved from the like status list cache based on the identifier of the target object and the identifier of the object being liked, and the target like data is displayed to the client. This allows for direct querying of like data upon cache hit, achieving efficient data reading, reducing latency, and solving the problem of low query efficiency for like data in high-concurrency scenarios. It enables accurate querying directly in the distributed cache, significantly reducing database access and improving query efficiency and system scalability.
[0017] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a flowchart of a like data query method provided in Embodiment 1 of the present invention;
[0020] Figure 2 This is a flowchart of a like data query method provided in Embodiment 2 of the present invention;
[0021] Figure 3 This is a flowchart of a like data query method provided in Embodiment 3 of the present invention;
[0022] Figure 4 This is a schematic diagram of a like data query device according to Embodiment 4 of the present invention;
[0023] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the like data query method of this invention. Detailed Implementation
[0024] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0025] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0026] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0027] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0028] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0029] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.
[0030] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0031] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.
[0032] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.
[0033] Example 1
[0034] Figure 1 The flowchart of a like data query method provided in Embodiment 1 of the present invention is applicable to like status query scenarios on high-concurrency social and content platforms. The method can be executed by a like data query device, which can be implemented in hardware and / or software, or optionally through an electronic device, such as a mobile terminal, PC, or server.
[0035] like Figure 1As shown, the method may specifically include:
[0036] S110. Receive a client's query request for like data of a liking object, determine the liking object identifier and the liking object identifier based on the query request, and query the like status list cache in the distributed cache based on the liking object identifier and the liking object identifier; the cached data in the like status list cache is stored with the liking object identifier as the key, the liking object identifier as the field, and the like status and the number of likes as the values.
[0037] The client can be understood as the device or application initiating the request, including but not limited to the user's browser, mobile app, or other system components. The client sends a like data query request to obtain the like status and quantity of a user's likes on specific content (such as articles, videos, or comments). The like object can be understood as the user or account that initiated the like behavior, the executor of the like action. The like data query request can be understood as a request initiated by the client to query the like status of a specific user on specific content, used to trigger the query process, including querying the like object identifier and the liked object identifier. The like object identifier can be understood as a unique identifier identifying the user or account that initiated the like behavior, used to identify which object performed the like operation, and is one of the key parameters for querying the like status. The liked object identifier can be understood as a unique identifier identifying the content or object that was liked, including but not limited to article ID, comment ID, and video ID, used to identify the specific content liked by the like object, and is another key parameter for querying like data. The distributed cache can be understood as a technology that stores cached data on multiple nodes, used for fast reading and writing of like data, avoiding frequent database access, and improving system response speed and throughput. The like status list cache can be understood as a data structure that stores like status and count in the cache, using a hash structure for efficient storage and querying of user like status for multiple pieces of content, improving system performance. The key can be understood as an identifier for the liked object, quickly hashed to locate data partitions, used to locate all user information that liked that content. The field can be understood as the "key" in a key-value pair, used to further distinguish data to query the like status of a specific liked object. The value can be understood as the stored content corresponding to the field, including the like status and the number of likes. The like status can be understood as whether the user has already liked the object. The number of likes can be understood as the total number of times or the number of people who liked it. The storage structure of the like status list cache can be: Liked object identifier: {Like object identifier: [Like status, Number of likes]}.
[0038] S120. If the identifier of the liked object and the identifier of the liked object are found in the cache of the like status list, the target like data is obtained from the cache of the like status list based on the identifier of the liked object and the identifier of the liked object, and the target like data is displayed to the client.
[0039] The target like data can be understood as the query results, including like status and / or like count, which are returned to the client to display the current like status or like count to the user.
[0040] Based on the above scheme, optionally, obtaining like data from the like status list cache according to the like object identifier and the liked object identifier includes: determining the like data in the like status list cache corresponding to the liked object identifier and the like object identifier as the target like data.
[0041] In one optional implementation, the key of the liked object identifier is looked up, and the corresponding field (i.e., the liked object identifier) is determined based on the key, thereby determining the like data ([like status, like count]), and the like data is sent to the client as the target like data.
[0042] This technical solution directly locates the liking status of the liking object to the liking object through caching, avoiding frequent database queries, significantly improving read efficiency and system response speed, and reducing database load.
[0043] The technical solution of this invention involves receiving a client's query request for like data of a target object, determining the identifier of the target object and the identifier of the object being liked based on the query request, and querying the like status list cache in a distributed cache based on the identifier of the target object and the identifier of the object being liked. Since the cached data in the like status list cache uses the identifier of the object being liked as the key, the identifier of the target object as the field, and the like status and number of likes as values, query performance is improved and database pressure is reduced. Then, if the identifier of the target object and the identifier of the object being liked are found in the like status list cache, the target like data is retrieved from the like status list cache based on the identifier of the target object and the identifier of the object being liked, and the target like data is displayed to the client. This allows for direct querying of like data upon cache hit, achieving efficient data reading, reducing latency, and solving the problem of low query efficiency for like data in high-concurrency scenarios. It enables accurate querying directly in the distributed cache, significantly reducing database access and improving query efficiency and system scalability.
[0044] Example 2
[0045] Figure 2This is a flowchart of a method for querying like data according to Embodiment 2 of the present invention, which is a further supplement to the above embodiments. Optionally, before responding to the client's request for querying like data for the like object, the method further includes: obtaining like operation records of the like object for the liked object within a preset time period, determining a like status message based on the like operation records, updating the distributed cache based on the like status message, and updating the database based on the distributed cache; wherein, the like operation records include performing a like operation, performing a cancel like operation, performing a dislike operation, performing a cancel dislike operation, and no operation. For detailed implementation, please refer to the description of this embodiment. Technical features that are the same as or similar to those in the foregoing embodiments will not be repeated here.
[0046] like Figure 2 As shown, the method may specifically include:
[0047] S210. Obtain the like operation records of the like object for the liked object within a preset time period, determine the like status message according to the like operation records, update the distributed cache according to the like status message, and update the database based on the distributed cache; wherein, the like operation records include performing like operation, performing cancel like operation, performing dislike operation, performing cancel dislike operation, and no operation.
[0048] The preset time period can be understood as a pre-defined time range (such as the past 5 minutes, half an hour, etc.) used to control the frequency of data synchronization, avoid frequent database writes or cache updates, and improve system performance and stability. The "like" operation record can be understood as a log recording the operations performed by the liking object on the liked object, including the following five behaviors: performing a like operation, performing a cancel like operation, performing a dislike operation, performing a cancel dislike operation, and no operation. The "performing a like" operation can be understood as the liking object clicking the "like" button, indicating that the liking object supports or likes the content, and the like count should increase, updating the status to "liked". The "performing a cancel like" operation indicates that the liking object cancels the previous like action, indicating that the liking object retracts the like, and the like count should decrease, updating the status to "not liked". The "performing a dislike" operation can be understood as the liking object clicking the "dislike" (or "oppose") button, indicating that the liking object does not agree with the content or is not interested in it, which may increase the "dislike count" and affect the content recommendation weight. The "cancel dislike" operation can be understood as the "like" object canceling its previous dislike behavior, used to undo the dislike operation, reduce the number of dislikes, and restore a neutral state. "No action" can be understood as the "like" object not performing any like / dislike actions on the content within the specified time period, indicating that the "like" object did not participate in the interaction. This usually does not trigger a state update, but the default state needs to be considered during state merging. The "like status information" can be understood as the final state information determined based on the like operation records, including likes, dislikes, and no action. The "database" can be understood as a tool used to long-term store statistical data on the behavior of like objects and the objects being liked, storing detailed records of like operations.
[0049] Based on the above scheme, optionally, determining the like status message according to the like operation record includes: determining the final like result according to the like operation record, and determining the like status information according to the like result, wherein the like result includes like, dislike and no operation.
[0050] In one optional implementation, the object being liked may perform multiple like, dislike, and right actions on the object being liked within a preset time period, or it may not perform any action. The final "like" result for the object being liked after these actions within the preset time period is determined (like, dislike, or no action), and the "like" status information is updated based on this result. The distributed cache is also updated based on the "like" status information, changing the "like" status stored in the distributed cache and updating the "like" count. For example, if the distributed cache initially stores a "like" status and the "like" result is "no action," it means that a "dislike" action was performed, and the "like" count in the distributed cache is decremented by 1.
[0051] By merging multiple operations of the "like" object within a preset time period, this technical solution accurately determines the final interaction state, avoids interference from intermediate states, ensures the accuracy of like, dislike, or neutral results, improves data consistency, and provides a reliable basis for distributed caching and database updates.
[0052] Optionally, based on the above scheme, the distributed cache further includes a like status change cache, wherein the cached data in the like status change cache is stored with a preset identifier as the key, the liked object identifier as the value, and the like time as the timestamp; the step of updating the database based on the distributed cache further includes: sorting the like status messages according to the timestamp, and updating the cached data in the like status change cache in the distributed cache to the database according to the sorting result and the liked object identifier.
[0053] The "like status change cache" can be understood as a specific data area in a distributed cache, used to store records of changes in a user's "like" status. The preset identifier can be understood as a key that uniquely identifies a "like status change" record. The timestamp indicates the time when the "like" operation occurred.
[0054] This technical solution sorts like events by timestamp, ensuring that the database persists interaction records in chronological order, supports functions such as "latest likes", improves the real-time performance and accuracy of data display, and utilizes caching to update the database in batches in an orderly manner, reducing write pressure and improving system throughput and consistency.
[0055] S220. Receive a client's query request for like data of a liking object, determine the liking object identifier and the liking object identifier based on the query request, and query the like status list cache in the distributed cache based on the liking object identifier and the liking object identifier; the cached data in the like status list cache is stored with the liking object identifier as the key, the liking object identifier as the field, and the like status and the number of likes as the values.
[0056] S230. If the identifier of the liked object and the identifier of the liked object are found in the cache of the like status list, the target like data is obtained from the cache of the like status list based on the identifier of the liked object and the identifier of the liked object, and the target like data is displayed to the client.
[0057] The technical solution of this invention batch processes various like operation records within a preset time period, generates a unified like status message to asynchronously update the distributed cache, and finally updates the database based on the cache. This effectively reduces frequent read and write operations on the database, significantly reduces system I / O pressure, and improves data processing efficiency and system throughput. At the same time, it ensures eventual consistency between the cache and the database, enhancing the scalability and stability of the system.
[0058] Example 3
[0059] Figure 3 This is a flowchart of a like data query method provided in Embodiment 3 of the present invention, which is a further supplement to the above embodiments. Optionally, the method further includes: if the like object identifier and the liked object identifier are not found in the like status list cache, obtaining like data from the database based on the like object identifier and the liked object identifier, and updating the distributed cache based on the like data; wherein, the database includes a like event table and a like statistics table, the like event table stores the like object identifier, the liked object identifier, and the like status, and is arranged in descending order of like time; the like statistics table establishes an association identifier based on the liked object identifier and the like event, and stores the number of likes. For specific implementation details, please refer to the description of this embodiment. Technical features that are the same as or similar to those in the foregoing embodiments will not be repeated here.
[0060] like Figure 3 As shown, the method may specifically include:
[0061] S310. Receive a client's query request for like data of a liking object, determine the liking object identifier and the liking object identifier based on the query request, and query the like status list cache in the distributed cache based on the liking object identifier and the liking object identifier; the cached data in the like status list cache is stored with the liking object identifier as the key, the liking object identifier as the field, and the like status and like count as the value.
[0062] S320. If the liked object identifier and the liked object identifier are not found in the liked status list cache, the target liked data is obtained from the database based on the liked object identifier and the liked object identifier, the distributed cache is updated based on the target liked data, and the target liked data is displayed to the client; wherein, the database includes a liked event table and a liked statistics table, the liked event table stores the liked object identifier, the liked object identifier, and the liked status, and is arranged in reverse order of liked time; the liked statistics table establishes an association identifier based on the liked object identifier and the liked event, and stores the number of likes.
[0063] The "like event table" can be understood as a table in a database, used to store all atomic event records of liking / unliking. The "like statistics table" can be understood as a summary table in the database storing the total number of likes for each liked object. The "association identifier" can be understood as a key used to associate the liked object identifier and the like event, and can thus be used to associate the like event table and the like statistics table.
[0064] Based on the above scheme, optionally, obtaining the target like data in the database according to the like object identifier and the liked object identifier includes: determining the target like data from the like event table according to the like time, the like object identifier and the liked object identifier.
[0065] In one optional implementation, based on the liked object identifier and the liked object identifier, combined with the latest liked time, the user's most recent liked operation record for the specified content is queried from the like event table to determine its current like status, and this status is used as the target like data for subsequent cache updates and client display.
[0066] This technical solution accurately locates the latest liking status by using the liking object identifier, the liked object identifier, and the liking time, ensuring data accuracy, supporting time-sorted queries, and improving the efficiency and consistency of data retrieval.
[0067] Based on the above scheme, optionally, updating the distributed cache according to the target like data includes: obtaining the liked object identifier and the number of likes from the like statistics table; determining the like event according to the liked object identifier, wherein the like event includes the like object identifier and the like status; and updating the distributed cache according to the liked object identifier, the like event, and the number of likes.
[0068] In one optional implementation, the number of likes corresponding to the object being liked is obtained from the like statistics table based on the object being liked's identifier. Then, the relevant like records are queried from the like event table in combination with the identifier to obtain the object being liked's identifier and like status. Subsequently, the distributed cache is updated with the object being liked's identifier as the cache key, the object being liked's identifier as the field, and its corresponding like status and the number of likes in the statistics table as the values.
[0069] This technical solution integrates the number of likes from the like statistics table with the detailed status from the like event table, and updates the distributed cache to ensure that the cached data is comprehensive and accurate. This enables efficient association between the liked object identifier and the interaction information of the like object, improves cache hit rate and query performance, and ensures consistency between the cache and the database.
[0070] The technical solution of this invention ensures data accuracy and the continuity of distributed cache data by retrieving the source database and updating the distributed cache when the cache misses. It also utilizes a like event table arranged in reverse chronological order and a highly efficient like statistics table in the database to quickly retrieve and backfill the distributed cache, reducing the overhead of repeated queries, improving the overall read performance and response efficiency of the system, and ensuring eventual data consistency.
[0071] Example 4
[0072] Figure 4 This is a schematic diagram of a like data query device provided in Embodiment 4 of the present invention. Figure 4 As shown, the device includes a query module 410 and an acquisition and display module 420. Among them,
[0073] The query module 310 is used to receive a query request from the client for like data of a like object, determine the like object identifier and the liked object identifier based on the like data query request, and query the like status list cache in the distributed cache based on the like object identifier and the liked object identifier; the cached data in the like status list cache is stored with the liked object identifier as the key, the like object identifier as the field, and the like status and like count as values; the acquisition and display module 320 is used to, when the like object identifier and the liked object identifier are found in the like status list cache, retrieve the target like data from the like status list cache based on the like object identifier and the liked object identifier, and display the target like data to the client.
[0074] The technical solution of this invention involves a query module receiving a client's query request for like data of a liked object. Based on the query request, the module determines the identifier of the liked object and the identifier of the object being liked. It then queries the like status list cache in a distributed cache based on the identifiers of the liked object and the object being liked. Since the cached data in the like status list cache uses the identifier of the object being liked as the key, the identifier of the liked object as the field, and the like status and number of likes as values, query performance is improved and database pressure is reduced. Next, if the like object identifier and the identifier of the object being liked are found in the like status list cache by the acquisition and display module, the module retrieves the target like data from the like status list cache based on these identifiers and displays the target like data to the client. This allows for direct querying of like data upon cache hit, achieving efficient data reading, reducing latency, and solving the problem of low query efficiency for like data in high-concurrency scenarios. It enables accurate queries directly from the distributed cache, significantly reducing database access and improving query efficiency and system scalability.
[0075] Optionally, based on the above solution, the acquisition and display module includes a target like data determination submodule. The target like data determination submodule is used to determine the like data in the like status list cache corresponding to the liked object identifier and the like object identifier as the target like data.
[0076] Based on the above solution, optionally, the like data query device includes: an update module. The update module is configured to, before responding to a client's like data query request for a like object, obtain like operation records of the like object on the liked object within a preset time period, determine a like status message based on the like operation records, update the distributed cache based on the like status message, and update the database based on the distributed cache; wherein the like operation records include performing a like operation, performing a cancel like operation, performing a dislike operation, performing a cancel dislike operation, and no operation.
[0077] Based on the above solution, optionally, the update module includes a "like status information determination submodule". This submodule is used to determine the final like result based on the like operation record, and to determine the like status information based on the like result, wherein the like result includes like, dislike, and no action.
[0078] Optionally, based on the above scheme, the distributed cache further includes a "like status change" cache, wherein the cached data in the "like status change" cache is stored with a preset identifier as the key, the identifier of the liked object as the value, and the like time as the timestamp; the update module includes a database update submodule. The database update submodule is used to sort the like status messages according to the timestamp, and update the cached data in the "like status change" cache in the distributed cache to the database according to the sorting result and the identifier of the liked object.
[0079] Based on the above solution, optionally, the like data query device includes: an acquisition and update module. The acquisition and update module is used to, when the like object identifier and the liked object identifier are not found in the like status list cache, acquire target like data from the database based on the like object identifier and the liked object identifier, and update the distributed cache based on the target like data; wherein the database includes a like event table and a like statistics table, the like event table stores the like object identifier, the liked object identifier, and the like status, and is arranged in descending order of like time; the like statistics table establishes an association between the liked object identifier and the like event, and stores the number of likes.
[0080] Based on the above solution, optionally, the update acquisition module includes: a like data acquisition submodule. The like data acquisition submodule is used to determine target like data from the like event table based on the like time, the like object identifier, and the liked object identifier.
[0081] Based on the above scheme, optionally, the update acquisition module includes an update submodule. The update submodule is used to acquire the liked object identifier and the number of likes from the like statistics table; determine the like event based on the liked object identifier, wherein the like event includes the like object identifier and the like status; and update the distributed cache based on the liked object identifier, the like event, and the number of likes.
[0082] Based on the above scheme, optionally, the target like data includes like status and / or like count.
[0083] The like data query device provided in this embodiment of the invention can execute the like data query method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0084] Example 5
[0085] Figure 5 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0086] like Figure 5As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0087] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0088] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as a like data query method.
[0089] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, it performs the functions defined in the methods of the embodiments of the present invention.
[0090] In some embodiments, a like data query method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the like data query method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform a like data query method by any other suitable means (e.g., by means of firmware).
[0091] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transferring data and instructions to the storage system, the at least one input device, and the at least one output device.
[0092] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0093] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0094] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0095] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0096] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0097] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0098] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method for querying like data, characterized in that, include: The system receives a query request from a client for like data of a liking object, determines the liking object identifier and the liking object identifier based on the query request, and performs a query based on the like status list cache in the distributed cache based on the like object identifier and the liking object identifier. The cached data in the like status list cache is stored with the liking object identifier as the key, the like object identifier as the field, and the like status and like count as the values. If the identifier of the liked object and the identifier of the liked object are found in the cache of the like status list, the target like data is obtained from the cache of the like status list based on the identifier of the liked object and the identifier of the liked object, and the target like data is displayed to the client.
2. The method according to claim 1, characterized in that, The step of retrieving like data from the like status list cache based on the like object identifier and the liked object identifier includes: The like data corresponding to the liked object identifier and the like object identifier in the like status list cache is determined as the target like data.
3. The method according to claim 1, characterized in that, Before receiving the client's query request for like data of the liked object, the method further includes: The system retrieves the like operation records of the like objects within a preset time period, determines the like status message based on the like operation records, updates the distributed cache based on the like status message, and updates the database based on the distributed cache; wherein, the like operation records include performing a like operation, performing a cancel like operation, performing a dislike operation, performing a cancel dislike operation, and no operation.
4. The method according to claim 3, characterized in that, The step of determining the like status message based on the like operation record includes: The final like result is determined based on the like operation record, and the like status information is determined based on the like result, wherein the like result includes like, dislike, and no operation.
5. The method according to claim 3, characterized in that, The distributed cache also includes a like status change cache, wherein the cached data in the like status change cache is stored with a preset identifier as the key, the identifier of the liked object as the value, and the like time as the timestamp; The method of updating the database based on the distributed cache also includes: The like status messages are sorted according to the timestamp, and the cached data in the like status change cache in the distributed cache is updated to the database according to the sorting result and the like object identifier.
6. The method according to claim 1, characterized in that, The method further includes: If the liked object identifier and the liked object identifier are not found in the liked status list cache, the target liked data is obtained from the database based on the liked object identifier and the liked object identifier, and the distributed cache is updated based on the target liked data. The database includes a liked event table and a liked statistics table. The liked event table stores the liked object identifier, the liked object identifier, and the liked status, and is arranged in descending order of liked time. The liked statistics table establishes an association between the liked object identifier and the liked event, and stores the number of likes.
7. The method according to claim 6, characterized in that, The step of obtaining the target like data from the database based on the like object identifier and the liked object identifier includes: The target like data is determined from the like event table based on the like time, the like object identifier, and the liked object identifier.
8. The method according to claim 6, characterized in that, The step of updating the distributed cache based on the target like data includes: Obtain the identifier of the liked object and the number of likes from the like statistics table, and determine the like event based on the identifier of the liked object, wherein the like event includes the identifier of the liked object and the like status; The distributed cache is updated based on the identifier of the object being liked, the like event, and the number of likes.
9. The method according to claim 1, characterized in that, The target like data includes like status and / or like count.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the like data query method according to any one of claims 1-7.