Active Query Method and Apparatus Based on Memory Caching, Readable Medium, Device, and Program Product

By adding memory cache to the equity service layer memory, the third-level caching mechanism is used to solve the problem of single point performance bottleneck for distributed cache, achieving higher performance capacity and query success rate, and reducing equipment costs.

CN115801813BActive Publication Date: 2025-06-17INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211410385.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-11
Publication Date
2025-06-17
Estimated Expiration
2042-11-11

AI Technical Summary

Technical Problem

In distributed application scenarios, the hash structure of the activity list leads to a bottleneck in the performance of distributed caches. When it exceeds 150tps, transaction blockage and query failure will occur, and the equipment cost is high.

Method used

Add memory cache to the equity service layer memory, reduce dependence on distributed cache through the third-level caching mechanism (memory cache-distributed cache-database), and improve performance capacity and query success rate.

Benefits of technology

It effectively reduces equipment costs, improves overall performance capacity and query success rate, and reduces dependence on distributed cache nodes and network resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115801813B_ABST
    Figure CN115801813B_ABST
Patent Text Reader

Abstract

An embodiment of the present invention provides a method and device for activity query based on memory cache, which can be used in the field of artificial intelligence technology. The method includes: obtaining a user access request, where the user access request includes a user identification code; matching a corresponding memory cache according to the user identification code; querying a full activity list from the memory cache; and screening out a corresponding user activity list from the full activity list according to the user identification code based on a pre-set user class table. By adding a memory cache in the memory of the rights and interests service layer, the device cost is reduced, and the overall performance capacity and query success rate are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, particularly to the field of artificial intelligence technology, and more particularly to a method and device for activity query based on memory cache. Background Art

[0002] In the existing distributed application scenarios, the requests of different users can be transferred to the designated sub-layer for processing, so as to achieve flexible expansion of the system concurrency throughput capacity. For the common content such as the activity list, it is shared and used in all sub-layers of the rights and interests service layer, and there is a single-point performance bottleneck limitation. In the related art, the overall performance capacity is increased through horizontal expansion of the distributed cache to relieve the bottleneck limitation. However, since the activity list is in a hash structure, the activity list is stored on a single node of the distributed cache, and there is a bandwidth limitation for a single node of the distributed cache. When the overall business volume exceeds 150 transactions per second (TransactionPerSecond, abbreviated as: tps), the distributed cache query will have transaction jams, gradually conducting the overall failure to the rights and interests service layer, resulting in query failures and relatively high equipment costs. Summary of the Invention

[0003] An object of the present invention is to provide a method for activity query based on memory cache, which reduces equipment costs, improves the overall performance capacity and query success rate by adding memory cache in the memory of the rights and interests service layer. Another object of the present invention is to provide a device for activity query based on memory cache. Still another object of the present invention is to provide a computer-readable medium. Yet another object of the present invention is to provide a computer device.

[0004] To achieve the above purposes, on the one hand, the present invention discloses a method for activity query based on memory cache, including:

[0005] Obtain a user access request, where the user access request includes a user identification code;

[0006] Match the corresponding memory cache according to the user identification code;

[0007] Query the full activity list from the memory cache;

[0008] Screen out the corresponding user activity list from the full activity list according to the pre-set user class list according to the user identification code.

[0009] Preferably, matching the corresponding memory cache according to the user identification code includes:

[0010] Perform a hash calculation on the user identification code to obtain a service layer key value;

[0011] Match the corresponding memory cache according to the key value of the service layer.

[0012] Preferably, query the full activity list from the memory cache, including:

[0013] Statistical time interval between the update time of the memory cache and the current time;

[0014] If the time interval is less than the preset interval threshold, query the full activity list from the memory cache.

[0015] Preferably, the method further includes:

[0016] If the time interval is greater than or equal to the preset interval threshold, match the corresponding distributed cache node according to the memory cache;

[0017] Query the full activity list from the distributed cache node.

[0018] Preferably, query the full activity list from the distributed cache node, including:

[0019] Send an activity acquisition request to the distributed cache node;

[0020] Receive the full activity list sent by the distributed cache node within the set time period.

[0021] Preferably, the method further includes:

[0022] If the full activity list sent by the distributed cache node is not received within the set time period or an abnormal message is received, determine whether the current number of exceptions is greater than or equal to the exception count threshold;

[0023] If so, call the common service layer to obtain the full activity list from the corresponding common database;

[0024] If not, increment the current number of exceptions by 1 and repeat the step of sending an activity acquisition request to the distributed cache node.

[0025] Preferably, the method further includes:

[0026] Obtain the full activity list from the distributed cache node according to the preset update period;

[0027] Update the full activity list stored in the memory cache according to the obtained full activity list.

[0028] Preferably, the user class table includes user identification codes and corresponding user class information, and the full activity list includes multiple activities and user condition information corresponding to each activity;

[0029] According to a pre-set user class list, filter out the corresponding user activity list from the full activity list according to the user identification code, including:

[0030] Through the user class list, match the corresponding user class information according to the user identification code;

[0031] Through the full activity list, match the user class information with the user condition information, and filter out the corresponding user activity list.

[0032] Preferably, the method further includes:

[0033] Call the public service layer to periodically update the distributed cache nodes according to the corresponding public database.

[0034] Preferably, after filtering out the corresponding user activity list from the full activity list according to the pre-set user class list, it further includes:

[0035] Visually display the user activity list.

[0036] The present invention also discloses an activity query device based on memory cache, including:

[0037] A first acquisition unit for acquiring a user access request, where the user access request includes a user identification code;

[0038] A first matching unit for matching the corresponding memory cache according to the user identification code;

[0039] A first query unit for querying the full activity list from the memory cache;

[0040] A filtering unit for filtering out the corresponding user activity list from the full activity list according to the pre-set user class list and the user identification code.

[0041] The present invention also discloses a computer-readable medium, on which a computer program is stored, and when the program is executed by a processor, the above-mentioned method is implemented.

[0042] The present invention also discloses a computer device, including a memory and a processor, the memory is used to store information including program instructions, the processor is used to control the execution of the program instructions, and when the processor executes the program, the above-mentioned method is implemented.

[0043] The present invention also discloses a computer program product, including computer program / instructions, and when the computer program / instructions are executed by a processor, the above-mentioned method is implemented

[0044] The present invention obtains a user access request, where the user access request includes a user identification code; based on the user identification code, a corresponding memory cache is matched; a full activity list is retrieved from the memory cache; according to a pre-set user class list, a corresponding user activity list is filtered from the full activity list based on the user identification code. By adding a memory cache in the memory of the rights and interests service layer, the device cost is reduced, and the overall performance capacity and query success rate are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.

[0046] Figure 1 FIG. is a schematic structural diagram of an activity query system based on a memory cache provided by an embodiment of the present invention;

[0047] Figure 2 FIG. is a flowchart of a method for querying activities based on a memory cache provided by an embodiment of the present invention;

[0048] Figure 3 FIG. is a flowchart of another method for querying activities based on a memory cache provided by an embodiment of the present invention;

[0049] Figure 4 FIG. is a schematic structural diagram of an activity query device based on a memory cache provided by an embodiment of the present invention;

[0050] Figure 5 FIG. is a schematic structural diagram of a computer device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0051] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, rather than all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.

[0052] It should be noted that a method and device for querying activities based on a memory cache disclosed in this application can be used in the field of artificial intelligence technology, and can also be used in any field other than the field of artificial intelligence technology. The application field of a method and device for querying activities based on a memory cache disclosed in this application is not limited.

[0053] To facilitate the understanding of the technical solution provided in this application, the relevant content of the technical solution of this application will be described below. Against the backdrop of the transformation from traditional operation models to digital operations, each enterprise is promoting the construction of an enterprise-level Internet intelligent operation platform, building an operation platform centered around users and covering four operation capabilities: channel operation, product operation, user operation, and content operation. The scenarios applicable to the present invention include, in response to a user logging in to a relevant channel application (such as mobile banking), matching the obtained full-scale activity list according to the user's information (such as region, customer group, label, etc.), screening out the activity list that conforms to the current user, and displaying it.

[0054] Under the architecture of distributed caching, by caching the activity list in the distributed cache, the performance of the overall list query can be improved. There is a bandwidth limit for a single node of the distributed cache, generally 100 - 150M / s. If the storage space occupied by the activity list is 1M (about 50K for a single activity, 200 activities), the overall transaction TPS is 100 - 150tps. When the overall business volume exceeds 150tps, transaction congestion will occur in the distributed cache query, gradually transmitting the overall failure to the rights and interests service layer, resulting in phenomena such as transaction timeouts and failures. Based on the improvement of performance capacity expansion through multi-node storage in the distributed cache, a three-level cache is added to the memory in the rights and interests service layer to reduce the access volume of the distributed cache, thereby further improving the overall performance capacity on the basis of controlling the investment in distributed cache devices and network traffic.

[0055] Activity publishing belongs to low-frequency transactions and is not updated frequently. A delay of 5 - 10 minutes is allowed from the time of activity publishing to its effectiveness. Based on this premise, a three-level cache mechanism is built for the activity list, namely: in-memory cache - distributed cache - database. By means of the three-level cache mechanism, the dependence on the distributed cache is reduced, thereby improving the overall performance capacity.

[0056] Figure 1 It is a schematic structural diagram of an activity query system based on in-memory cache provided by an embodiment of the present invention, as Figure 1As shown in the figure, the system includes a rights and interests service access layer, multiple database sub-layers, a public service layer, a public database, and a cache access node. The rights and interests service access layer is respectively connected to the public service layer and the cache access node, and the public service layer is respectively connected to the public database and the cache access node. The rights and interests service access layer includes multiple rights and interests service access sub-layers, and each rights and interests service access sub-layer is connected to a corresponding database sub-layer. The multiple rights and interests service access sub-layers are rights and interests service layer set1, rights and interests service layer set2,..., rights and interests service layer setN, and the multiple database sub-layers are database set1, database set2,..., database setN. Rights and interests service layer set1 corresponds to database set1, rights and interests service layer set2 corresponds to database set2,..., rights and interests service layer setN corresponds to database setN. Rights and interests service layer set1 is connected to database set1, rights and interests service layer set2 is connected to database set2,..., rights and interests service layer setN is connected to database setN. The cache access node includes multiple distributed cache nodes, specifically distributed cache node 1, distributed cache node 2, distributed cache node 3,..., distributed cache node N.

[0057] As Figure 1 shown in the figure, each rights and interests service access sub-layer is provided with a memory cache for storing the full activity list. Further, each rights and interests service access sub-layer is also provided with a timer to periodically access the distributed cache to obtain the full activity list, and update the full activity list stored in the memory cache according to the obtained full activity list, and record the update time at the same time.

[0058] It should be noted that Figure 1 the activity query system based on the memory cache shown in the figure is also applicable to Figure 2 or Figure 3 the activity query method based on the memory cache, which will not be elaborated here.

[0059] Taking the activity query device based on the memory cache as the execution subject as an example below, the implementation process of the activity query method based on the memory cache provided by the embodiments of the present invention will be described. It can be understood that the execution subject of the activity query method based on the memory cache provided by the embodiments of the present invention includes but is not limited to the activity query device based on the memory cache.

[0060] Figure 2 is a flowchart of an activity query method based on the memory cache provided by the embodiments of the present invention. As Figure 2 shown in the figure, the method includes:

[0061] Step 101, obtain a user access request, and the user access request includes a user identification code.

[0062] Step 102, match the corresponding memory cache according to the user identification code.

[0063] Step 103: Query the full activity list from the memory cache.

[0064] Step 104: According to the pre-set user class list, filter out the corresponding user activity list from the full activity list based on the user identification code.

[0065] In the technical solution provided by the embodiment of the present invention, a user access request is obtained, and the user access request includes a user identification code; according to the user identification code, the corresponding memory cache is matched; the full activity list is queried from the memory cache; according to the pre-set user class list, the corresponding user activity list is filtered out from the full activity list. By adding a memory cache in the memory of the rights and interests service layer, the device cost is reduced, and the overall performance capacity and query success rate are improved.

[0066] Figure 3 It is a flowchart of another activity query method based on memory cache provided by the embodiment of the present invention. As Figure 3 shown, the method includes:

[0067] Step 201: Obtain a user access request, and the user access request includes a user identification code.

[0068] In the embodiment of the present invention, each step is executed by an activity query device based on a memory cache.

[0069] In the embodiment of the present invention, the user identification code (Userid) can uniquely identify a user. After the user logs in to the relevant channel application, a user access request is generated to obtain an activity list for display to the user.

[0070] Step 202: Perform a hash calculation on the user identification code to obtain a service layer key value.

[0071] In the embodiment of the present invention, a hash calculation is performed on the user identification code (Userid) to obtain a service layer key value (Key). As an optional solution, the user identification code (Userid) is hashed by Hash(Userid) % N to obtain a service layer key value (Key), where N is the number of rights and interests service access sub-layers.

[0072] In the embodiment of the present invention, the service layer key value (Key) can uniquely identify a rights and interests service access sub-layer.

[0073] Step 203: Match the corresponding memory cache according to the service layer key value.

[0074] In the embodiments of the present invention, each rights and interests service access sub-layer has a key value of the service layer, and the identification number of each rights and interests service access sub-layer is pre-allocated. Specifically, the key value of the service layer is allocated through a hash algorithm and the number N of rights and interests service access sub-layers to achieve a discrete effect. For example: each Key value is assigned to a rights and interests service access sub-layer.

[0075] Specifically, the corresponding rights and interests service access sub-layer is matched according to the key value of the service layer; each rights and interests service access sub-layer is provided with a corresponding memory cache, and the corresponding memory cache is matched according to the rights and interests service access sub-layer.

[0076] Step 204: Statistically calculate the time interval between the update time of the memory cache and the current time.

[0077] In the embodiments of the present invention, the memory cache includes the update time of the last update, and the time interval is calculated according to the update time and the current time.

[0078] Step 205: Determine whether the time interval is less than a preset interval threshold. If so, execute step 206; if not, execute step 207.

[0079] In the embodiments of the present invention, the interval threshold is set according to actual requirements, and the embodiments of the present invention do not limit this. As an optional solution, the interval threshold is 3 minutes.

[0080] Specifically, if the time interval is less than the interval threshold, it indicates that the current memory cache is relatively close to the last update time, and the full activity list stored in the memory cache is accurate, and step 206 is continued to be executed; if the time interval is greater than or equal to the interval threshold, it indicates that the current memory cache is relatively far from the last update time, and the full activity list stored in the memory cache is not accurate enough, and step 207 is continued to be executed.

[0081] Step 206: Query the full activity list from the memory cache, and continue to execute step 209.

[0082] In the embodiments of the present invention, since the full activity list is stored in the memory cache and the time interval is less than the interval threshold, the full activity list is directly obtained from the memory cache.

[0083] Further, obtain the full activity list from the distributed cache nodes according to a preset update period; update the full activity list stored in the memory cache according to the obtained full activity list. The update period is preset according to actual requirements, and the embodiments of the present invention do not limit this. As an alternative, the update period is 1 minute. Specifically, in the rights and interests service access layer, add a background thread task to obtain the full activity list through the distributed cache nodes every 1 minute, update the obtained full activity list to the full activity list in the memory cache, and at the same time update the current update time to the current time.

[0084] Step 207: Match the corresponding distributed cache node according to the memory cache.

[0085] Specifically, each rights and interests service access sub-layer corresponds to a distributed cache node; match the corresponding distributed cache node according to the rights and interests service access sub-layer where the memory cache is located.

[0086] Further, if the time since the last update of the memory cache is relatively long, obtain the full activity list through the distributed cache node, update the obtained full activity list to the full activity list in the memory cache, and at the same time update the current update time to the current time.

[0087] Further, to avoid multiple threads accessing the distributed cache and updating the memory cache simultaneously, design the update mechanism when the memory cache is unavailable to be thread-safe, and access and update it with a lock (synchronized).

[0088] Step 208: Query the full activity list from the distributed cache node.

[0089] Specifically, send an activity acquisition request to the corresponding distributed cache node according to the Key value; receive the full activity list sent by the distributed cache node within a set time period. The time period is preset according to actual requirements, and the embodiments of the present invention do not limit this.

[0090] In the embodiments of the present invention, the full activity list is stored in each distributed cache node.

[0091] Further, if the full activity list sent by the distributed cache node is not received within the set time period or an abnormal message is received, determine whether the current number of exceptions is greater than or equal to the exception threshold; if so, call the public service layer to obtain the full activity list from the corresponding public database; if not, increment the current number of exceptions by 1 and repeat the step of sending an activity acquisition request to the distributed cache node until the full activity list is obtained or the current number of exceptions is greater than or equal to the exception threshold. As an optional solution, the initial value of the current number of exceptions is 0, and the exception threshold is 2.

[0092] Further, call the public service layer to perform periodic updates on the distributed cache node according to the corresponding public database. The public service layer is connected to the public database, and the public database stores the full activity list and periodically updates the distributed cache node and the rights and interests service access sub-layer.

[0093] Step 209: According to the pre-set user class table, screen out the corresponding user activity list from the full activity list according to the user identification code.

[0094] In the embodiment of the present invention, the user class table can be set according to actual needs. As an optional solution, the user class table includes the user identification code and the corresponding user class information, and the full activity list includes various activities and the user condition information corresponding to each activity. The user class information includes but is not limited to region, customer group, and label; the user condition information includes but is not limited to region, customer group, and label.

[0095] In the embodiment of the present invention, step 209 specifically includes:

[0096] Step 2091: Through the user class table, match the corresponding user class information according to the user identification code.

[0097] In the embodiment of the present invention, match the user identification code in the user access request with the user identification code in the user class table to obtain the corresponding user class information.

[0098] Step 2092: Through the full activity list, match the user class information with the user condition information and screen out the corresponding user activity list.

[0099] In the embodiment of the present invention, match the user class information with the user condition information, and screen out the matched activities; generate a user activity list according to the screened activities. The activities in the user activity list are activities that the user can participate in and match the user.

[0100] Step 210: Visualize the user activity list.

[0101] In an embodiment of the present invention, the user activity list is visually displayed so that the user can view the activities that can be participated in.

[0102] In an embodiment of the present invention, through a three-level cache design (memory - distributed cache - database), the access volume to distributed cache nodes is effectively reduced, thereby reducing the equipment investment requirement and network occupancy. Under the distributed application architecture, the nodes in the rights and interests service layer are horizontally scaled out. For the access to the distributed cache, the increase depends on the number of added nodes. Ideally, a single node is accessed once per minute. Compared with the original single-node concurrency (such as 50 tps), it is reduced by 50×60 = 3000 times. The distributed cache is reduced by 9000 times in terms of equipment investment requirement and network resource consumption. With the change of single-node concurrency and the adjustment of the memory refresh cycle, the optimization effect may be further expanded. It effectively reduces the dependence and consumption of business node scaling on distributed cache nodes and network resources in the distributed scenario, thereby further improving the performance capacity of the entire system.

[0103] In the technical solution of the activity query method based on memory cache provided by an embodiment of the present invention, a user access request is obtained. The user access request includes a user identification code; according to the user identification code, the corresponding memory cache is matched; the full activity list is queried from the memory cache; according to the pre-set user class table, the corresponding user activity list is filtered out from the full activity list according to the user identification code. By adding a memory cache in the memory of the rights and interests service layer, the equipment cost is reduced, and the overall performance capacity and query success rate are improved.

[0104] Figure 4 It is a structural schematic diagram of an activity query device based on memory cache provided by an embodiment of the present invention. This device is used to execute the above-mentioned activity query method based on memory cache, as Figure 4 shown, this device includes: a first acquisition unit 11, a first matching unit 12, a first query unit 13, and a filtering unit 14.

[0105] The first acquisition unit 11 is used to obtain a user access request, and the user access request includes a user identification code.

[0106] The first matching unit 12 is used to match the corresponding memory cache according to the user identification code.

[0107] The first query unit 13 is used to query the full activity list from the memory cache.

[0108] The filtering unit 14 is used to filter out the corresponding user activity list from the full activity list according to the pre-set user class table and the user identification code.

[0109] In an embodiment of the present invention, the first matching unit 12 is specifically configured to perform a hash calculation on the user identification code to obtain a key value of the service layer; and match a corresponding memory cache according to the key value of the service layer.

[0110] In an embodiment of the present invention, the first query unit 13 is specifically configured to count the time interval between the update time of the memory cache and the current time; if the time interval is less than a preset interval threshold, query the full activity list from the memory cache.

[0111] In an embodiment of the present invention, the device further includes: a second matching unit 15 and a second query unit 16.

[0112] The second matching unit 15 is configured to, if the time interval is greater than or equal to the preset interval threshold, match a corresponding distributed cache node according to the memory cache.

[0113] The second query unit 16 is configured to query the full activity list from the distributed cache node.

[0114] In an embodiment of the present invention, the second query unit 16 is specifically configured to send an activity acquisition request to the distributed cache node; and receive the full activity list sent by the distributed cache node within a set time period.

[0115] In an embodiment of the present invention, the device further includes: a judgment unit 17.

[0116] The judgment unit 17 is configured to, if the full activity list sent by the distributed cache node is not received within the set time period or an abnormal message is received, judge whether the current number of abnormal times is greater than or equal to the abnormal times threshold; if so, call the public service layer to obtain the full activity list from the corresponding public database; if not, increment the current number of abnormal times by 1 and repeat the step of sending the activity acquisition request to the distributed cache node.

[0117] In an embodiment of the present invention, the device further includes: a second acquisition unit 18 and an update unit 19.

[0118] The second acquisition unit 18 is configured to obtain the full activity list from the distributed cache node according to a preset update period.

[0119] The update unit 19 is configured to update the full activity list stored in the memory cache according to the obtained full activity list.

[0120] In an embodiment of the present invention, the user class table includes a user identification code and corresponding user class information, and the full activity list includes multiple activities and user condition information corresponding to each activity; the screening unit 14 is configured to match the corresponding user class information through the user class table according to the user identification code; and match the user class information with the user condition information through the full activity list to screen out the corresponding user activity list.

[0121] In an embodiment of the present invention, the device further includes: a calling unit 20.

[0122] The calling unit 20 is used to call the common service layer and perform periodic updates on the distributed cache nodes according to the corresponding common database.

[0123] In an embodiment of the present invention, the device further includes: a visualization unit 21.

[0124] The visualization unit 21 is used to visually display the user activity list.

[0125] In the solution of the embodiment of the present invention, a user access request is obtained, and the user access request includes a user identification code; according to the user identification code, the corresponding memory cache is matched; the full activity list is queried from the memory cache; according to the pre-set user class list, the corresponding user activity list is filtered out from the full activity list according to the user identification code. By adding a memory cache in the memory of the rights and interests service layer, the device cost is reduced, and the overall performance capacity and query success rate are improved.

[0126] The system, device, module or unit described in the above embodiments can be specifically implemented by a computer chip or an entity, or by a product with a certain function. A typical implementation device is a computer device. Specifically, the computer device can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or any combination of these devices.

[0127] An embodiment of the present invention provides a computer device, including a memory and a processor. The memory is used to store information including program instructions, and the processor is used to control the execution of the program instructions. When the program instructions are loaded and executed by the processor, the steps of the above embodiments of the activity query method based on memory cache are implemented. For specific descriptions, reference can be made to the embodiments of the activity query method based on memory cache above.

[0128] Next, refer to Figure 5 , which shows a schematic structural diagram of a computer device 600 suitable for implementing the embodiments of the present application.

[0129] As Figure 5As shown, the computer device 600 includes a central processing unit (CPU) 601, which can perform various appropriate operations and processes according to the program stored in the read-only memory (ROM) 602 or the program loaded from the storage section 608 into the random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the computer device 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. The input / output (I / O) interface 605 is also connected to the bus 604.

[0130] The following components are connected to the I / O interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc. and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the I / O interface 605 as required. A removable medium 611, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 610 as required so that a computer program read from it can be installed in the storage section 608 as required.

[0131] Specifically, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program tangibly embodied on a machine-readable medium, and the computer program includes program code for performing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 609, and / or installed from the removable medium 611.

[0132] A computer-readable medium includes both permanent and non-permanent, removable and non-removable media and can implement information storage by any method or technology. The information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tapes, magnetic disk storage or other magnetic storage devices, or any other non-transitory medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media such as modulated data signals and carrier waves.

[0133] For the convenience of description, when describing the above devices, they are described as various units according to their functions. Of course, when implementing the present application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0134] The present invention is described with reference to the flowcharts and / or block diagrams of methods, apparatuses (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, and the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing devices generate means for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0135] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including instruction means that implement the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.

[0136] These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process Figure 1 one process or multiple processes and / or blocks Figure 1 steps for the functions specified in one block or multiple blocks.

[0137] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, commodity or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or also elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising the said element.

[0138] In the technical solution of this application, the acquisition, storage, use, processing, etc. of data all comply with the relevant provisions of national laws and regulations.

[0139] Those skilled in the art should understand that the embodiments of this application can be provided as methods, systems or computer program products. Therefore, this application can take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware aspects. Moreover, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk memories, CD-ROMs, optical memories, etc.) containing computer-usable program codes.

[0140] This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0141] Each embodiment in this specification is described in a progressive manner. For parts that are the same or similar among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, since they are basically similar to method embodiments, the description is relatively simple, and reference can be made to the corresponding parts of the method embodiments for the relevant content.

[0142] The above are only embodiments of the present application and are not intended to limit the present application. For those skilled in the art, various changes and modifications can be made to the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims

1. An activity query method based on memory caching, characterized in that, Applied to an activity query system The activity query system includes: a rights and interests service access layer, multiple database sub-layers, a public service layer, a public database, and cache access nodes; The rights and interests service access layer includes multiple rights and interests service access sub-layers corresponding one-to-one to the multiple database sub-layers. The cache access nodes include multiple distributed cache nodes respectively arranged in each rights and interests service access sub-layer. A full activity list is stored in each distributed cache node; The method includes: Obtain a user access request, where the user access request includes a user identification code; Match a corresponding memory cache according to the user identification code; Query the full activity list from the memory cache; According to a pre-set user class table, screen out a corresponding user activity list from the full activity list according to the user identification code; The matching of the corresponding memory cache according to the user identification code includes: Perform a hash calculation on the user identification code to obtain a service layer key value; Match a corresponding memory cache according to the service layer key value; The user class table includes a user identification code and corresponding user class information. The full activity list includes multiple activities and user condition information corresponding to each activity; The screening of the corresponding user activity list from the full activity list according to the pre-set user class table according to the user identification code includes: Match the user identification code with the user identification codes in the user class table to obtain corresponding user class information; Through the full activity list, match the user class information with the user condition information to screen out the corresponding user activity list.

2. The activity query method based on memory caching according to claim 1, characterized in that, The querying of the full activity list from the memory cache includes: Statistical time interval between the update time of the memory cache and the current time; If the time interval is less than a preset interval threshold, query the full activity list from the memory cache.

3. The activity query method based on memory caching according to claim 2, characterized in that, The method further includes: If the time interval is greater than or equal to the preset interval threshold, match a corresponding distributed cache node according to the memory cache; Query the full activity list from the distributed cache node.

4. The activity query method based on memory caching according to claim 3, characterized in that, The querying of the full activity list from the distributed cache node includes: Send an activity acquisition request to the distributed cache node; Receive the full activity list sent by the distributed cache node within a set time period.

5. The activity query method based on memory caching according to claim 4, characterized in that, The method further includes: If the full activity list sent by the distributed cache node is not received within a set time period or an abnormal message is received, determine whether the current number of abnormal times is greater than or equal to the abnormal times threshold; If so, call the public service layer to obtain the full activity list from the corresponding public database; If not, increment the current number of abnormal times by 1 and repeat the step of sending the activity acquisition request to the distributed cache node.

6. The activity query method based on memory caching according to claim 3, characterized in that, The method further includes: Obtain the full activity list from the distributed cache node according to a preset update period; Update the full activity list stored in the memory cache according to the obtained full activity list.

7. The method for querying activities based on in-memory caching according to claim 3, wherein, The method further includes: Call the public service layer to periodically update the distributed cache nodes according to the corresponding public database.

8. The method for querying activities based on in-memory caching according to claim 1, wherein, After screening out the corresponding user activity list from the full activity list according to the user identification code based on the pre-set user class table, it further includes: Visualize the user activity list.

9. An apparatus for querying activities based on in-memory caching, wherein, The activity query device is integrated in the activity query system. The activity query system includes: a rights and interests service access layer, multiple database sub-layers, a public service layer, a public database, and cache access nodes. The rights and interests service access layer includes multiple rights and interests service access sub-layers corresponding one-to-one to the multiple database sub-layers. The cache access nodes include multiple distributed cache nodes respectively set in each rights and interests service access sub-layer. Each distributed cache node stores a full activity list. The activity query device includes: A first acquisition unit for acquiring a user access request, where the user access request includes a user identification code. A first matching unit for matching the corresponding memory cache according to the user identification code. A first query unit for querying the full activity list from the memory cache. A screening unit for screening out the corresponding user activity list from the full activity list according to the user identification code based on the pre-set user class table. The first matching unit is specifically configured to perform a hash calculation on the user identification code to obtain a service layer key value; and match the corresponding memory cache according to the service layer key value. The user class table includes a user identification code and corresponding user class information. The full activity list includes multiple activities and user condition information corresponding to each activity. The screening unit is specifically configured to match the user identification code with the user identification code in the user class table to obtain the corresponding user class information; and match the user class information with the user condition information through the full activity list to screen out the corresponding user activity list.

10. A computer-readable medium having a computer program stored thereon, wherein, When the program is executed by a processor, it implements the activity query method based on memory cache according to any one of claims 1 to 8.

11. A computer device comprising a memory and a processor, the memory being used for storing information including program instructions, and the processor being used for controlling the execution of the program instructions, wherein, When the program instructions are loaded and executed by a processor, it implements the activity query method based on memory cache according to any one of claims 1 to 8.

12. A computer program product comprising a computer program / instructions, wherein, When the computer program / instructions are executed by a processor, it implements the activity query method based on memory cache according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data access method and device

    CN110968603A

  • Data query method and device, equipment, storage medium and program product

    CN114691725A