Data processing method and device, electronic equipment, storage medium and program product

By setting up the middleware layer between the Redis server and the client, using the access frequency and time window conditions, the hotspot data is judged in real time and pushed to the middleware layer, the cache breakdown problem caused by the Redis server due to hotspot data is solved, and data processing efficiency and system stability are improved.

CN120429326APending Publication Date: 2025-08-05CHINA MOBILE INFORMATION TECHNOLOGY CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202510926646.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-07
Publication Date
2025-08-05

AI Technical Summary

Technical Problem

In high concurrency scenarios, the Redis server fails to respond to the access changes of hotspot data in real time, resulting in cache breakdown, forming traffic peaks, affecting data processing efficiency.

Method used

By setting up the middleware layer between the client and the Redis server, using the access frequency and time window conditions, hotspot data is judged in real time and pushed to the middleware layer, and the cache is dynamically managed.

Benefits of technology

Effectively reduce the load on Redis servers, improve data processing efficiency, ensure fast response to high-frequency access, reduce resource waste, and improve system stability and throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120429326A_ABST
    Figure CN120429326A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of computer data processing.The method comprises the steps that the number of access times of a client to a target key in a Redis server is larger than or equal to a preset value; pushing a data object corresponding to the target key to a middleware layer under the condition that the target key is accessed by the client and the time of each access of the client to the target key is before a preset deadline; wherein the middleware layer is a cache structure arranged between the client and the Redis server, and the preset deadline is determined based on pre-configured access period information and the initial access time of the target key. According to the method and the device, the problem of use blockage of the value corresponding to the key in a large business scene can be solved, the load of the Redis server is reduced, and the data processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer data processing technology, and in particular to a data processing method, device, electronic device, storage medium and program product. Background Art

[0002] Redis, as a high-performance cache database, is widely used in hot data storage scenarios. By caching hot data in memory, it effectively alleviates database performance bottlenecks and reduces response latency. It supports a variety of data types, including strings, hashes, lists, sets, and ordered sets. Combined with clustering or sentinel mode, it enables high availability and horizontal scalability. However, Redis's single-threaded architecture and large-capacity key storage method can easily lead to "hot key" issues. In high-concurrency scenarios, if hot keys are not effectively managed, concentrated access to hot data can cause cache overflow, leading to a large number of requests directly hitting the backend database and causing traffic spikes. Related technologies typically optimize key structures and monitor access frequency to avoid high load at single points. However, traditional solutions rely on periodic scanning at the middleware layer to determine hot keys, which cannot respond to key access changes in real time. This results in a lag in hot key determination and can easily block the use of key values in large-scale business scenarios. Summary of the Invention

[0003] The embodiments of the present application provide a data processing method, device, electronic device, storage medium and program product, which can solve the problem of blocked use of the value (Value) corresponding to the key in large business scenarios, reduce the load of the Redis server, and improve data processing efficiency.

[0004] In a first aspect, an embodiment of the present application provides a data processing method applied to a Redis server, the method comprising: If the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before the preset deadline, the data object corresponding to the target key is pushed to the middleware layer; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

[0005] Optionally, the data object corresponding to the target key includes the value corresponding to the target key and the start access time; The field corresponding to the start access time is set after the field corresponding to the value corresponding to the target key.

[0006] Optionally, when the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, after pushing the data object corresponding to the target key to the middleware layer, the method further includes: If the target key is updated before the preset deadline, the start access time is updated to a first access time, where the first access time is the time when the target key is updated; The updated target key value and the first access time are pushed to the middleware layer to update the target key value and the start access time of the target key cached by the middleware layer.

[0007] Optionally, when the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, before pushing the data object corresponding to the target key to the middleware layer, the method further includes: When the Redis server is in a stopped state, setting a hotspot switch parameter in a configuration file of the Redis server to a first parameter, and configuring the access cycle information in the configuration file; When the Redis server is in the startup state, each access to the target key by the client is received.

[0008] Optionally, the method further includes: When the time when the client performs the first access to the target key exceeds the preset deadline, the first access is determined as the first access of the client to the target key, and the start access time is updated to the time when the client performs the first access.

[0009] Optionally, after pushing the target key to the middleware layer, the method further includes: In case the client does not access the target key before the preset deadline arrives, the middleware layer is instructed to delete the target key.

[0010] In a second aspect, an embodiment of the present application further provides a data processing device, applied to a Redis server, comprising: A push module is configured to push a target key to the middleware layer if the number of times a client accesses a target key in the Redis server is greater than or equal to a preset value and the time of each access by the client to the target key is before a preset deadline; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

[0011] In a third aspect, an embodiment of the present application provides an electronic device comprising: a processor, a memory, and a program stored on the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the data processing method described in any one of the first aspects are implemented.

[0012] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the data processing method as described in any one of the first aspects are implemented.

[0013] In a fifth aspect, an embodiment of the present application further provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the steps of the data processing method as described in any one of the first aspects.

[0014] In an embodiment of the present application, by judging the access frequency and time window of the client to the target key in the Redis server, the data object is pushed to the middleware layer intelligently, effectively improving system performance and resource utilization. Only when the number of times the client accesses the target key in the Redis server is greater than or equal to the preset value, and the time when the client accesses the target key is before the preset deadline, the data object corresponding to the target key is pushed to the middleware layer. Moreover, by judging and identifying the target key in the Redis server, real-time determination of hot keys is achieved directly on the Redis server component code. Therefore, the embodiment of the present application realizes dynamic management of data cache through a conditional trigger mechanism, which not only ensures a rapid response to high-frequency access data, but also reduces the waste of resources caused by low-frequency access, improves the overall throughput and stability of the Redis server, and improves data processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0016] Figure 1 is a flow chart of a data processing method in an embodiment of the present application; Figure 2 yes Figure 1 Schematic diagram of the data type composition of the Redis server; Figure 3 is a schematic diagram of a data processing device in an embodiment of the present application; Figure 4 It is a schematic diagram of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0017] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0018] The embodiments of the present application provide a data processing method, device, electronic device, storage medium and program product. The embodiments of the present application are described in detail below through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0019] See Figure 1 A data processing method in an embodiment of the present application is applied to a Redis server, and the method specifically includes: Step 101: If the number of times a client accesses a target key in a Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, push the data object corresponding to the target key to the middleware layer; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

[0020] It should be noted that the number of visits to the target key can be recorded in real time through the HotStepLen_Proxy variable. Each time a client accesses the target key, HotStepLen_Proxy increases by 1. When the value of HotStepLen_Proxy reaches the preset threshold, that is, HotThreshold_Porxy, for example, 50 consecutive visits, a hotspot determination is triggered.

[0021] In a specific embodiment of this application, two trigger conditions are set for caching hot keys in the middleware layer: an access count limit and a time window limit. Only when the number of client accesses to the target key reaches a preset value, and the access time of each client access must be before the preset deadline, is the data considered "hot data" or the key a hotkey and needs to be cached in the middleware layer. The Redis server can push metadata such as the target key value (value) and the start access time (HotBegTime_Proxy) to the middleware layer through the proxy address (ProxyAddress) and proxy password (ProxyAuth) stored in a pre-configured configuration file.

[0022] It is worth mentioning that the above-mentioned preset deadline can be determined based on the start access time (HotBegTime_Proxy) and the access cycle information (HotKeyCycle). For example, if the hotspot start time is 10:00 and the cycle is 30 minutes, the deadline is 10:30. If each access time is before 10:30, the key can be considered a valid hotkey. Among them, the access cycle information can be a pre-set time period. For example, if the access cycle is 24 hours, the preset deadline is the start access time + 24 hours. Therefore, by setting the preset deadline, it can be ensured that only the recently frequently accessed data is cached to avoid redundancy.

[0023] As you can understand, the middleware layer acts as a secondary cache between the client and the Redis server, storing frequently accessed data objects. For example, when a client requests product information (e.g., key "product_123"), if the conditions are met, the Redis server can push the data to the middleware layer, such as a local in-memory cache or distributed cache. This allows subsequent requests to be directly responded to by the middleware layer, reducing the client's need to access the Redis server directly.

[0024] Furthermore, the preset values and access cycle information corresponding to the aforementioned access counts can be dynamically adjusted based on historical data in the Redis server. For example, through machine learning, access patterns can be analyzed and thresholds automatically optimized to adapt to business changes.

[0025] For example, consider a social platform's user dynamic data (e.g., key "feed_user1001"), which is frequently accessed. When the number of accesses reaches a preset threshold (e.g., 500), and each access occurs within 24 hours, the Redis server can push the data to the middleware layer. Subsequent user accesses can retrieve the data directly from the middleware, with the Redis server actively reading only if the middleware misses the request. If the user dynamic data is not accessed after 24 hours, the middleware layer will clean up the data according to its policy to avoid excessive resource consumption.

[0026] In this way, the embodiment of the present application can prevent network card congestion caused by hot key access in a single Redis node by distributing hot data to the middleware layer, thereby ensuring a fast response to high-frequency access data and reducing resource waste caused by low-frequency access, thereby improving the overall throughput and stability of the Redis server and improving data processing efficiency.

[0027] Optionally, the data object corresponding to the target key includes the value corresponding to the target key and the start access time; The field corresponding to the start access time is set after the field corresponding to the value corresponding to the target key.

[0028] It is understandable that Redis has five commonly used data types, including character (String), list (List), hash table (Hash), set (Set), and ordered set (SortedSet). Figure 2 As shown, in the specific application of Redis, the embodiments of this application design data structures based on these five commonly used underlying data types, including strings, doubly linked lists (LinkedList), sets of strings (Sets of Strings), sorted sets of strings (Sorted Sets of Strings), and hash tables (Hash tables). In addition, in some embodiments of this application, data structures such as skip lists (SkipList), integer sets (IntSet), and compressed lists (ZipList) can also be designed, but this application does not impose specific restrictions on this.

[0029] It's worth noting that this embodiment of the application is applicable to all data types in the Redis server, such as strings, hash tables, and sorted sets. Furthermore, other key operations, such as hash sets (hset), hash value retrieval (hget), lists (list), and streams, are all included in the hotkey statistics of this embodiment of the application and can be managed uniformly through the redisObject structure. For example, an hget operation on the hash key user:1001 will also be counted in HotStepLen_Proxy.

[0030] In some embodiments, the data object (redisObject) corresponding to a target key can consist of the value corresponding to the target key, the start access time, and the number of times the target key was accessed. This can be achieved by expanding the existing encoding format of the key-corresponding data object and adding two int fields to the existing data structure to store the start access time and the number of times the target key was accessed. Furthermore, the extended fields can be directly accessed through pointer arithmetic, eliminating the need for additional storage structures and avoiding memory waste.

[0031] In a specific embodiment, the data object of the key is a redisObject object with the following structure: typedef struct redisObject { unsigned type:4; / / type unsigned encoding:4; / / alignment bit unsigned lru:LRU_BITS; / / LRU time (relative to server.lruclock) int refcount; / / reference count void *ptr; / / points to the value of the object } robj; For example, the field corresponding to the value corresponding to the target key can correspond to the actual data pointed to by the pointer (ptr) in the redisObject structure, such as a string or integer. The field corresponding to the start access time, namely HotBegTime_Proxy, can be stored after the value data pointed to by the ptr pointer. For example, for a certain original encoding structure (OBJ_ENCODING_INT) in Redis, its original encoding format occupies sizeof(long), while the expanded encoding format occupies sizeof(long)+2*sizeof(int). The memory occupied by the start access time (HotBegTime_Proxy) is ptr+sizeof(long), and the memory occupied by the number of accesses (HotStepLen_Proxy) is ptr+sizeof(long)+sizeof(int).

[0032] In this way, the embodiment of the present application expands the starting access time and the number of accesses to the target key on the basis of the original key structure, so that the extended field can be directly accessed through pointer operations without the need for an additional storage structure, thus avoiding memory waste. At the same time, the extended structure facilitates the binding of the update of HotBegTime_Proxy and HotStepLen_Proxy to key operations, ensuring the real-time nature of hotspot determination. In addition, the above-mentioned extended fields can exist only in hotspot mode, and the original Redis logic does not need to be modified, so that the Redis server can achieve dynamic management of hotspot data through extended fields without destroying the original compatibility.

[0033] Optionally, when the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, after pushing the data object corresponding to the target key to the middleware layer, the method further includes: If the target key is updated before the preset deadline, the start access time is updated to a first access time, where the first access time is the time when the target key is updated; The updated target key value and the first access time are pushed to the middleware layer to update the target key value and the start access time of the target key cached by the middleware layer.

[0034] In some embodiments, when the target key is updated before the preset deadline (HotBegTime_Proxy + HotKeyCycle), the update logic is triggered. For example, if the hotspot start time HotBegTime_Proxy is 10:00 and the access cycle is 30 minutes, the deadline is 10:30. If the key is updated at 10:20, the condition is met. In addition, HotBegTime_Proxy can be reset to the update time, that is, the first access time. For example, the original HotBegTime_Proxy = 10:00, and after the update, it becomes 10:20. At the same time, HotStepLen_Proxy automatically increases by 1, indicating that the number of accesses to the key has increased. In this way, the updated target key (including the new HotBegTime_Proxy and HotStepLen_Proxy) will be pushed back to the middleware layer to ensure that the data cached by the middleware is consistent with Redis.

[0035] That is, when a hot key is updated, such as when a set key value occurs, the Redis server can synchronously refresh HotBegTime_Proxy and HotStepLen_Proxy, and re-push the hot key to the middleware layer.

[0036] Therefore, the embodiment of the present application enables the middleware layer to accurately reflect the latest access patterns of hot data by updating the start time in real time. For example, frequently updated keys (such as real-time rankings) will continue to remain in the middleware layer to avoid cache invalidation due to time expiration. In addition, synchronization is triggered only when the key is updated, rather than periodic scanning, to reduce system overhead. For example, if a key is updated once an hour, data is pushed only when it is updated, rather than checking once every minute. In addition, the updated start time in the embodiment of the present application ensures that the cache strategy of the middleware layer is based on the latest access data. For example, if a key is updated at 10:20, the middleware layer will extend the cache validity period of the key to 10:20 + HotKeyCycle to avoid premature elimination.

[0037] Optionally, when the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, before pushing the data object corresponding to the target key to the middleware layer, the method further includes: When the Redis server is in a stopped state, setting a hotspot switch parameter in a configuration file of the Redis server to a first parameter, and configuring the access cycle information in the configuration file; When the Redis server is in the startup state, each access to the target key by the client is received.

[0038] In some other embodiments, when the Redis server is in a stopped state, the hotspot switch parameter (HotkeyProxy) can be set in advance in the configuration file as the first parameter, such as yes, to enable the hotspot data detection function. Thus, the embodiment of the present application can use the hotspot switch parameter to configure whether to push the hotspot key. When it is turned off, the native mode can be completely restored. In addition, the access cycle information (HotKeyCycle) can also be set in the configuration file, such as 3600 seconds. This parameter can define the life cycle of the hotspot data and is used to calculate the preset deadline.

[0039] Thus, the embodiments of the present application can implement access processing in the Redis startup state. When the Redis server is started, it can continuously monitor the client's access requests to the target key. For example, when the client performs a GET key or SET key operation, Redis will record the timing information of each access. During the access process, the Redis server can dynamically determine whether the target key is a hot key based on HotBegTime_Proxy and HotKeyCycle.

[0040] In this way, the embodiments of the present application can flexibly control the hotspot detection function by configuring the Redis server in a stopped state. For example, the production environment can turn off HotkeyProxy to reduce resource consumption, while the test environment can turn it on to analyze hotspot data. At the same time, monitoring client access immediately after startup can ensure the timeliness of hotspot determination. The separation of configuration in the stopped state and access processing during runtime can also avoid stability issues caused by dynamic configuration modification at runtime.

[0041] Optionally, the method further includes: When the time when the client performs the first access to the target key exceeds the preset deadline, the first access is determined as the first access of the client to the target key, and the start access time is updated to the time when the client performs the first access.

[0042] In some embodiments, when the time of a client's first access to a target key, also known as the first access time, exceeds a preset deadline, the Redis server may treat this access as a new first access and reset HotBegTime_Proxy to the time of this access. For example, if the target key's HotBegTime_Proxy is 10:00 and the access cycle is 30 minutes (with a deadline of 10:30), but the client makes its first access at 10:30, it is determined to be a new hotspot and HotBegTime_Proxy is updated to 10:30. Additionally, when HotBegTime_Proxy is reset, HotStepLen_Proxy (number of accesses) may be reset to 1, restarting the count.

[0043] For example, assume the hotspot for the key product:123 starts at 10:00 and has a 30-minute access period (ending at 10:30). If a client accesses this key at 10:20, the system determines that it is within the deadline, increases HotStepLen_Proxy by 1, and maintains HotBegTime_Proxy at 10:00. If the client accesses this key for the first time at 10:30, it is considered a new hotspot, and HotBegTime_Proxy is updated to 10:30, resetting HotStepLen_Proxy to 1. If subsequent accesses are within 10:30 + 30 minutes (11:10), the system continues to count accesses; if the limit is exceeded, another reset is triggered.

[0044] In this way, the embodiment of the present application can ensure that the hotspot determination is always based on the latest access behavior, avoiding misjudgment due to time expiration. Specifically, by resetting the hotspot start time, the system can capture newly emerging hotspot data in a timely manner. For example, a certain product is frequently accessed during a promotion period. Even if it has not been marked as a hotspot before, the system can recalculate it when it is newly accessed. If the target key is accessed for the first time after the preset deadline, it means that it may no longer be active. Resetting the time at this time can prevent old hotspot data from occupying middleware resources. In addition, the new HotStepLen_Proxy starts counting from 1 to ensure that the hotspot determination is based on the latest access behavior. For example, if a key is first accessed at 10:30 and then accessed again at 10:50, HotStepLen_Proxy=2, which may trigger a push to the middleware layer.

[0045] Optionally, after pushing the target key to the middleware layer, the method further includes: In case the client does not access the target key before the preset deadline arrives, the middleware layer is instructed to delete the target key.

[0046] It should be noted that the preset expiration time is determined by HotBegTime_Proxy and HotKeyCycle. If the client does not access the target key before this time, the hotspot status of the key can be considered invalid. For example, if HotBegTime_Proxy = 10:00 and HotKeyCycle = 30 minutes, the preset expiration time is 10:30. If the client does not access the key before 10:30, the deletion logic can be triggered.

[0047] In some embodiments, the middleware layer can monitor the comparison between the HotBegTime_Proxy of the target key and the current time through a scheduled task (such as checking once every minute). If the current time has exceeded the preset deadline and no access record is detected, a deletion operation is performed. When deleting, the middleware layer directly removes the target key and its associated HotBegTime_Proxy and HotStepLen_Proxy fields to release cache resources. In this way, the middleware layer can dynamically adjust the cache strategy based on HotStepLen_Proxy and HotBegTime_Proxy. If a key is accessed 100 times within 1 hour, it will continue to remain in the middleware layer; if there is no access for more than 2 hours, it will be automatically eliminated.

[0048] In this way, the embodiment of the present application can avoid the middleware layer from storing hot data that has not been accessed for a long time, thereby reducing memory usage. By combining scheduled tasks with time windows, the middleware layer data is ensured to be synchronized with actual access requirements. In addition, the maintenance cost of invalid data in the middleware layer can also be reduced. For example, if a key has not been accessed before 10:30, the system does not need to check the cache status of the key in subsequent requests.

[0049] Please refer to Figure 3 , Figure 3 2 is a schematic diagram of a data processing device according to an embodiment of the present application. The data processing device 200 specifically includes: Push module 201, configured to push the target key to the middleware layer if the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value and the time of each access of the client to the target key is before a preset deadline; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

[0050] Optionally, the data object corresponding to the target key includes the value corresponding to the target key and the start access time; The field corresponding to the start access time is set after the field corresponding to the value corresponding to the target key.

[0051] Optionally, the data processing device 200 further includes: An updating module, configured to update the start access time to a first access time when the target key is updated before the preset deadline, the first access time being the time when the target key is updated; The updated target key and the first access time are pushed to the middleware layer to update the target key and the start access time of the target key cached by the middleware layer.

[0052] Optionally, the data processing device 200 further includes: A configuration module, configured to set a hotspot switch parameter in a configuration file of the Redis server to a first parameter when the Redis server is in a stopped state, and to configure the access cycle information in the configuration file; The receiving module is used to receive each access to the target key by the client when the Redis server is in the startup state.

[0053] Optionally, the data processing device 200 further includes: A determination module is used to determine the first access as the first access of the client to the target key when the time when the client performs the first access to the target key exceeds the preset deadline, and to update the starting access time to the time when the client performs the first access.

[0054] Optionally, the data processing device 200 further includes: The instructing module is configured to instruct the middleware layer to delete the target key if the client does not access the target key before the preset deadline.

[0055] The data processing device 200 provided in the embodiment of the present application can execute the above Figure 1 The implementation principle and technical effects of the method embodiment shown are similar, and will not be described in detail in this embodiment.

[0056] The present application also provides an electronic device. Since the principle of solving the problem of the electronic device is similar to the image detection model training method in the present application, the implementation of the electronic device can refer to Figure 1 The implementation of the method shown in FIG. 1 is omitted for repetition. Figure 4 As shown, the electronic device of the embodiment of the present application includes: a processor 310, which is used to read the program in the memory 320 and execute the following process: If the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, push the target key to the middleware layer; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

[0057] The transceiver 330 is configured to receive and send data under the control of the processor 310 .

[0058] Among them, Figure 4 In the embodiment of the present invention, the bus architecture may include any number of interconnected buses and bridges, specifically linking various circuits such as one or more processors represented by processor 310 and memory represented by memory 320. The bus architecture may also link various other circuits such as peripheral devices, voltage regulators, and power management circuits, which are well known in the art and are not further described herein. The bus interface provides an interface.

[0059] Optionally, the data object corresponding to the target key includes the value corresponding to the target key and the start access time; The field corresponding to the start access time is set after the field corresponding to the value corresponding to the target key.

[0060] Optionally, the processor 310 is further configured to read a program in the memory 320 and perform the following steps: If the target key is updated before the preset deadline, the start access time is updated to a first access time, where the first access time is the time when the target key is updated; The updated target key value and the first access time are pushed to the middleware layer to update the target key value and the start access time of the target key cached by the middleware layer.

[0061] Optionally, the processor 310 is further configured to read a program in the memory 320 and perform the following steps: When the Redis server is in a stopped state, setting a hotspot switch parameter in a configuration file of the Redis server to a first parameter, and configuring the access cycle information in the configuration file; When the Redis server is in the startup state, each access to the target key by the client is received through the transceiver 330 .

[0062] Optionally, the processor 310 is further configured to read a program in the memory 320 and perform the following steps: When the time when the client performs the first access to the target key exceeds the preset deadline, the first access is determined as the first access of the client to the target key, and the start access time is updated to the time when the client performs the first access.

[0063] Optionally, the processor 310 is further configured to read a program in the memory 320 and perform the following steps: In case the client does not access the target key before the preset deadline arrives, the middleware layer is instructed to delete the target key.

[0064] The electronic device provided in the embodiment of the present application can perform the above Figure 1 The implementation principle and technical effects of the method embodiment shown are similar, and will not be described in detail in this embodiment.

[0065] The present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the above-mentioned Figure 1The various processes of the data processing method embodiment in the embodiment can achieve the same technical effect and are not described here in detail to avoid repetition. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0066] The embodiment of the present application further provides a computer program / program product, which is stored in a storage medium and is executed by at least one processor to implement the above Figure 1 The various processes of the data processing method embodiment can achieve the same technical effect, and to avoid repetition, they will not be described here.

[0067] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection of some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0068] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may be physically included separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0069] The above-mentioned integrated unit implemented as a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to perform some of the steps of the sending and receiving methods described in various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0070] The above is a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles described in the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A data processing method, characterized in that: Applied to a Redis server, the method includes: If the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before the preset deadline, the data object corresponding to the target key is pushed to the middleware layer; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

2. The method according to claim 1, characterized in that The data object corresponding to the target key includes the value corresponding to the target key and the start access time; The field corresponding to the start access time is set after the field corresponding to the value corresponding to the target key.

3. The method according to claim 1 or 2, characterized in that After pushing the data object corresponding to the target key to the middleware layer if the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value and the time of each access of the target key by the client is before a preset deadline, the method further includes: If the target key is updated before the preset deadline, the start access time is updated to a first access time, where the first access time is the time when the target key is updated; The updated target key value and the first access time are pushed to the middleware layer to update the target key value and the start access time of the target key cached by the middleware layer.

4. The method according to claim 1, wherein When the number of times the client accesses the target key in the Redis server is greater than or equal to a preset value, and the time of each access of the client to the target key is before a preset deadline, before pushing the data object corresponding to the target key to the middleware layer, the method further includes: When the Redis server is in a stopped state, setting a hotspot switch parameter in a configuration file of the Redis server to a first parameter, and configuring the access cycle information in the configuration file; When the Redis server is in the startup state, each access to the target key by the client is received.

5. The method according to claim 1 or 4, characterized in that The method further comprises: When the time when the client performs the first access to the target key exceeds the preset deadline, the first access is determined as the first access of the client to the target key, and the start access time is updated to the time when the client performs the first access.

6. The method according to claim 1 or 2, characterized in that After pushing the target key to the middleware layer, the method further includes: In case the client does not access the target key before the preset deadline arrives, the middleware layer is instructed to delete the target key.

7. A data processing device, characterized in that: Applied to a Redis server, the device includes: A push module is configured to push a target key to the middleware layer if the number of times a client accesses a target key in the Redis server is greater than or equal to a preset value and the time of each access by the client to the target key is before a preset deadline; The middleware layer is a cache structure provided between the client and the Redis server, and the preset deadline is determined based on pre-configured access cycle information and a start access time of the target key.

8. An electronic device, characterized in that: include: A processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the data processing method according to any one of claims 1 to 6 are implemented.

9. A computer-readable storage medium for storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 6 are implemented.

10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps in the data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Buffering method, device and equipment and medium

    CN109120709A

  • Hotspot data caching method and system and electronic equipment

    CN113946591A

  • Hotspot data processing method and device, electronic equipment and medium

    CN115146128A

  • Cache management method, terminal, and storage medium

    WO2022028165A1