CN113297192B - Method and system for controlling field expiration aiming at redis hash type data - Google Patents

Method and system for controlling field expiration aiming at redis hash type data Download PDF

Info

Publication number
CN113297192B
CN113297192B CN202110605238.7A CN202110605238A CN113297192B CN 113297192 B CN113297192 B CN 113297192B CN 202110605238 A CN202110605238 A CN 202110605238A CN 113297192 B CN113297192 B CN 113297192B
Authority
CN
China
Prior art keywords
value
time
expiration
character string
redis
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110605238.7A
Other languages
Chinese (zh)
Other versions
CN113297192A (en
Inventor
盛猛
林立
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Aiqi Information Technology Co ltd
Original Assignee
Shanghai Aiqi Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Aiqi Information Technology Co ltd filed Critical Shanghai Aiqi Information Technology Co ltd
Priority to CN202110605238.7A priority Critical patent/CN113297192B/en
Publication of CN113297192A publication Critical patent/CN113297192A/en
Application granted granted Critical
Publication of CN113297192B publication Critical patent/CN113297192B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/215Improving data quality; Data cleansing, e.g. de-duplication, removing invalid entries or correcting typographical errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof

Abstract

The invention provides a method and a system for controlling field expiration aiming at redis hash type data, comprising the following steps: step S1: setting an expiration time unit and setting the length of a character string of an expiration time value; step S2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value; and step S3: calculating an expected expiration time value of the hash field according to the length of the character string of the expiration time value, the reference time and the current time; and step S4: the length of the character string of the expiration time value is complemented to the length of the character string of the set expiration time value, and a new expiration value character string is obtained; step S5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis; step S6: and scanning the hash value of the redis at fixed time, and deleting the field when the difference value between the current time and the reference time is greater than the expiration time value extracted from the hash value.

Description

Method and system for controlling field expiration aiming at redis hash type data
Technical Field
The present invention relates to the field of computer technology, and in particular, to a method, system, and medium for controlling field expiration for redis hash-type data.
Background
At present, in the aspect of carrying out expiration clearing on hash filtered, the following common processing modes are generally available:
the hash type data is directly deleted regularly in full or partially randomly, and the actually overdue hash file data cannot be effectively managed;
after the hash field type data is stored, the hash file is stored once again, and the value stored again is replaced by the expiration time value, namely the expiration control mechanism similar to the Expires of the system is built by self. By the method, the occupation of the memory space is greatly increased, the occupation of the CPU resource of the server is improved, and the operation of redis for many times is required when the inertia is deleted.
The self-built Expires solution has the advantage that a timer can be created for timing expiration control, but the scenario targeted by the self-built Expires solution is massive data, and when massive data is stored, if expiration is processed by creating the timer, the performance influence on a system CPU is catastrophic. And a massive data scene is not adopted, the necessity of converting key-value data into hash type storage is not great, and the default key of the system can be directly used for carrying out expiration control, so that a self-built Expires expiration solution is redundant.
Patent document CN110781190a (application No. 201911037918.2) discloses a method of expiration management for each field of a Redis hash, including: packaging the Redis Client to a custom JhRedis system; calling a custom JhRedis system to judge whether a current key has a corresponding SortedSet, if not, establishing a SortedSet for the current key, wherein the member of the SortedSet is equal to the field of the current key, and score is the expiration time of the field, and then writing data into the SortedSet; and calling a custom JhRedis system to read SortedSet of the current field, judging whether score of the custom JhRedis system is expired or not, if so, automatically cleaning data related to the current field, returning null data, and if not, returning value. The invention can realize the expiration management of each field. This processing scheme is only of little value for small-scale data, but is not necessary much because it can be stored directly in a key-value manner. The processing scheme is not preferable for mass data, occupies a system space by double, and additionally occupies a large amount of CPU time of the system, because a SortedSet needs to be created and maintained externally, and the SortedSet is similar to Expire of the redis system.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a method and a system for controlling field expiration aiming at redis hash type data.
The method for controlling field expiration aiming at the redis hash type data comprises the following steps:
step S1: setting an expiration time unit and setting the length of a character string of an expiration time value;
step S2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
and step S3: calculating an expected field expiration time value according to the string length of the expiration time value, the base time and the current time;
and step S4: the length of the character string of the expiration time value is filled to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
step S5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis;
step S6: and scanning the hash value of the redis at fixed time, and deleting the field when the difference value between the current time and the reference time is greater than the expiration time value extracted from the hash value.
Preferably, the step S1 includes: under the condition that the requirement of a service scene is met, the granularity setting of the time unit meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved.
Preferably, the step S3 includes:
step S3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
step S3.2: and adding the time difference value to the time length value expected to be cached to redis to obtain an expiration time value.
Preferably, the step S4 includes: and converting the acquired expiration time value into a character string, and adding 0 character to the left side of the character string until the length is equal when the length of the character string is less than that of the character string with the set expiration time value.
Preferably, the step S6 further includes: deleting the field by adopting an inert deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is inquired in the service operation, carrying out overdue judgment in real time, if the value is overdue, discarding the value inquired at the time, returning to null, and deleting the filed.
Preferably, the method further comprises the following steps: and supplementing a preset number to the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an expired control time value and a field without an expired control time value which is never expired so as to be compatible with the storage of the fields which are never expired.
Preferably, the method further comprises the following steps: when the original value is a number and the new value is filled with 0 characters, a number which is not 0 is added to the leftmost of the current new value, so that the new value is still stored in redis as an integer value.
The system for controlling field expiration aiming at redis hash type data provided by the invention comprises the following steps:
a module M1: setting an expiration time unit and setting the length of a character string of an expiration time value;
a module M2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
a module M3: calculating an expected expiration time value of the field according to the string length of the expiration time value, the base time, and the current time;
a module M4: the length of the character string of the expiration time value is filled to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
a module M5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis;
a module M6: and scanning the hash value of the redis at fixed time, and deleting the field when the difference value between the current time and the reference time is greater than the expiration time value extracted from the hash value.
Preferably, said module M1 comprises: under the condition that the service scene requirement is guaranteed to be met, the time unit granularity setting meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved;
the module M3 comprises:
module M3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
module M3.2: adding the time difference value to the time length value expected to be cached to redis to obtain an expiration time value;
the module M4 comprises: converting the obtained expiration time value into a character string, and adding 0 character on the left side of the character string when the length of the character string is smaller than the length of the character string of the set expiration time value until the lengths are equal;
the module M6 comprises: deleting the field by adopting an inertia deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is queried, carrying out overdue judgment in real time, if the value is overdue, discarding the value queried at the time, returning to null, and deleting the filed.
Preferably, the method further comprises the following steps: supplementing a preset number on the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an overdue control time value and a field without an overdue control time value which is never overdue so as to be compatible with the storage of the fields which are never overdue;
further comprising: when the original value is a number and the new value is filled with 0 characters, a number which is not 0 is added to the leftmost of the current new value, so that the new value is still stored in redis as an integer value.
Compared with the prior art, the invention has the following beneficial effects:
1. the invention solves a series of problems that the existing redis system can not carry out overdue control on the field of hash type data, and the overdue garbage data is resident in the redis, thereby wasting memory space, influencing the accuracy of service logic and the like;
2. according to the invention, the expiration time value is stored in value, the extra occupied storage space of the redis system is very small, and in an actual service scene, when only a time unit with a coarser granularity is needed, such as a DAY or HOUR time unit, the extra occupied space is almost ignored, so that the space is greatly saved;
3. when the redis stores the hash type data in a ziplist structure, the integer numerical data is stored in a binary system, so that the use of a memory space can be greatly reduced; the method for controlling field expiration does not increase extra data occupation, still keeps the original data structure and can still greatly reduce the use of memory space;
4. the invention divides the field corresponding to the value into the field with the overdue control time value and the field with the never overdue control time value, so as to be compatible with the storage of the never overdue field.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments with reference to the following drawings:
FIG. 1 is a diagram of new value.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the invention, but are not intended to limit the invention in any way. It should be noted that it would be obvious to those skilled in the art that various changes and modifications can be made without departing from the spirit of the invention. All falling within the scope of the present invention.
Example 1
The method for controlling field expiration aiming at the redis hash type data comprises the following steps: as shown in the figure 1 of the drawings,
step S1: setting an expiration time unit and setting the length of a character string of an expiration time value;
step S2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
and step S3: calculating an expected field expiration time value according to the string length of the expiration time value, the base time and the current time;
and step S4: the length of the character string of the expiration time value is complemented to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
step S5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis;
step S6: and scanning the hash value of the redis at fixed time, and deleting the field when the difference value between the current time and the reference time is greater than the expiration time value extracted from the hash value.
Specifically, the step S1 includes: under the condition that the requirement of a service scene is met, the granularity setting of the time unit meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved.
Specifically, the step S3 includes:
step S3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
step S3.2: and adding the time difference value to the expected time value cached to redis to obtain an expiration time value.
More specifically, assume that according to the traffic situation, an expiration time unit is defined as a day, and a reference time is defined as: on the 1 st/1 st 2021 year, the string length of the expiration time value is defined as 4, assuming that the current time is the 4 th/1 st/2021 year, if it is desired to set the expiration time to 2 days (i.e., the 4 th/3 rd/2021 year is expired), the expiration time value is the number of days between the 1 st/2021 and the 4 th/1 st/2021 year, and 2 is added to the number of days, that is, 92, since the string length of the expiration time value is 4 bits, the expired string should be 0092.
Specifically, the step S4 includes: and converting the acquired expiration time value into a character string, and adding 0 character to the left side of the character string until the length is equal when the length of the character string is less than that of the character string with the set expiration time value.
Specifically, the step S6 includes: deleting the field by adopting an inert deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is inquired, carrying out overdue judgment in real time, if the value is overdue, discarding the value inquired at the time, returning to null, and deleting the filed.
Specifically, the method further comprises the following steps: and supplementing a preset number to the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an expired control time value and a field without an expired control time value which is never expired so as to be compatible with the storage of the fields which are never expired.
For example: 1-marking the information of the expired value and 2-marking the information of the non-expired value, assuming that the value is abc, the expired time value is 92, and the length of the character string of the expired time value is 4 bits, the new value is: 10092abc; assuming that value is abc, without expiration, the new value is 2abc;
specifically, the method further comprises the following steps: when the original value is a number and the new value is filled with 0 characters, a number which is not 0 is added to the leftmost of the current new value, so that the new value is still stored in redis as an integer value.
The number of complementary non-0 is preferably as small as possible, and more preferably 1. Similarly, if the value is 999, the expiration time value is 92, and the length of the string of the expiration time value is 4 bits, the new value is 10092999. Because 10092999 is a number, when redis stored, the number can be identified as an integer value to be stored, and the integer is stored in binary in the redis, so that a large amount of space can be saved. If the left side is not supplemented with 1, namely 0092999, the system stores the data in the form of character strings.
The system for controlling field expiration aiming at redis hash type data provided by the invention comprises the following steps:
a module M1: setting an expiration time unit and setting the length of a character string of an expiration time value;
a module M2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
a module M3: calculating an expected field expiration time value according to the string length of the expiration time value, the base time and the current time;
a module M4: the length of the character string of the expiration time value is filled to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
a module M5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis;
a module M6: and scanning the hash value of the redis at fixed time, and deleting the field when the difference value between the current time and the reference time is greater than the expiration time value extracted from the hash value.
Specifically, the module M1 comprises: under the condition that the requirement of a service scene is met, the granularity setting of the time unit meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved.
In particular, said module M3 comprises:
module M3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
module M3.2: and adding the time difference value to the time length value expected to be cached to redis to obtain an expiration time value.
More specifically, assume that an expiration time unit is defined as day according to a service situation, and a reference time is defined as: on the 1 st/1 st 2021 year, the string length of the expiration time value is defined as 4, assuming that the current time is the 4 th/1 st/2021 year, if it is desired to set the expiration time to 2 days (i.e., the 4 th/3 rd/2021 year is expired), the expiration time value is the number of days between the 1 st/2021 and the 4 th/1 st/2021 year, and 2 is added to the number of days, that is, 92, since the string length of the expiration time value is 4 bits, the expired string should be 0092.
In particular, said module M4 comprises: and converting the acquired expiration time value into a character string, and adding 0 character to the left side of the character string until the length is equal when the length of the character string is less than that of the character string with the set expiration time value.
In particular, said module M6 comprises: deleting the field by adopting an inert deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is inquired, carrying out overdue judgment in real time, if the value is overdue, discarding the value inquired at the time, returning to null, and deleting the filed.
Specifically, the method further comprises the following steps: and supplementing a preset number to the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an expired control time value and a field without an expired control time value which is never expired so as to be compatible with the storage of the fields which are never expired.
For example: 1-marking the information of the expired value, 2-marking the information of the non-expired value, and assuming that the value is abc, the expired time value is 92, and the length of the character string of the expired time value is 4 bits, the new value is: 10092abc; assuming that value is abc, without expiration, the new value is 2abc;
specifically, the method further comprises the following steps: when the original value is a number and the new value is filled with 0 characters, a number which is not 0 is added to the leftmost of the current new value, so that the new value is still stored in redis as an integer value.
The number of complementary non-0 is preferably as small as possible, and more preferably 1. Similarly, if the value is 999, the expiration time value is 92, and the length of the string of the expiration time value is 4 bits, the new value is 10092999. Because 10092999 is a number, when redis stored, the number can be identified as an integer value to be stored, and the integer is stored in binary in the redis, so that a large amount of space can be saved. If not, i.e. 0092999, 1 is added to the left, then the system stores the data in a string.
Example 2
Example 2 is a preferred example of example 1
When hash type data are cached to redis, the expiration time and the value are merged and then stored, and the life cycle of the hash field is controlled by periodically scanning the value of the hash field.
Step 1: setting an expiration time unit and setting the length of a character string of an expiration time value, which are specifically explained as follows:
setting one of time units DAY \ HOUR \ MINUTE \ SECOND \ MINISOND, if the time unit is set to DAY, defining the length of the character string of the expiration time value to be 4, and setting the expiration time value range to be 1-9999 DAYs (DAY) at the moment, wherein the time range is enough to meet most service scenes. If the time unit is set to be second (second), the string length of the definable time value is 10 bits, and the expiration time range that can be set at this time is 1-9999999999 seconds.
Under the condition of ensuring that the requirement of a service scene is met, the granularity of a time unit is defined to be larger as much as possible so as to reduce the character string length setting value of an expiration time value and further save the space occupying redis;
step 2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
and step 3: calculating an expected expiration time value of the hash field;
the step 3 comprises the following steps:
step 3.1: calculating the time difference between the current time and the reference time in the step 2 by using the time unit defined in the step 1;
step 3.2: the expiration time value is equal to the time difference plus the expected buffer to redis duration value.
And 4, step 4: and (3) completing the character string length of the expiration time value to the character string length of the expiration time value defined in the step (1), wherein the completion mode is as follows: and converting the expiration time value into a character string, and if the length of the character string is less than the length of the character string of the defined expiration time value, adding a '0' character to the right side of the character string until the lengths are equal to obtain a new expiration value character string of which the length is the length of the character string of the expiration time value in the step one.
And 5: splicing the new overdue value character string and the hash value according to the character string type to obtain a new value, and storing the new value serving as the hash value into redis;
step 6: and scanning the value of the hash field at regular time, and deleting the hash field if the difference value between the current time and the reference time is greater than the expiration time value extracted from the value.
For the overdue deletion operation, in an actual service scene, an inert deletion mode can be adopted, namely, when the value of the hash file is queried, the overdue judgment is carried out immediately, if the value is overdue, the value queried at the current time is discarded, and the hash file is deleted
Those skilled in the art will appreciate that, in addition to implementing the systems, apparatus, and various modules thereof provided by the present invention in purely computer readable program code, the same procedures can be implemented entirely by logically programming method steps such that the systems, apparatus, and various modules thereof are provided in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Therefore, the system, the device and the modules thereof provided by the present invention can be considered as a hardware component, and the modules included in the system, the device and the modules thereof for implementing various programs can also be considered as structures in the hardware component; modules for performing various functions may also be considered to be both software programs for performing the methods and structures within hardware components.
The foregoing description of specific embodiments of the present invention has been presented. It is to be understood that the present invention is not limited to the specific embodiments described above, and that various changes or modifications may be made by one skilled in the art within the scope of the appended claims without departing from the spirit of the invention. The embodiments and features of the embodiments of the present application may be combined with each other arbitrarily without conflict.

Claims (6)

1. A method for controlling field expiration for redis hash-type data, comprising:
step S1: setting an expiration time unit and setting the length of a character string of an expiration time value;
step S2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
and step S3: calculating an expected field expiration time value according to the string length of the expiration time value, the base time and the current time;
and step S4: the length of the character string of the expiration time value is filled to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
step S5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis; wherein, DAY or HOUR time unit is adopted;
step S6: scanning a hash value of redis at regular time, and deleting the field when the difference value between the current time and the reference time is larger than the expiration time value extracted from the hash value;
when the redis stores hash type data in a zipplist structure, the integer numerical type data is stored in a binary system;
when the original value is a number and the new value is filled with 0 characters, supplementing a number which is not 0 to the leftmost side of the current new value, and enabling the new value to be stored in redis still as an integer value; the number which is not 0 is 1, so that when the redis is stored, the number which is identified as an integer is stored in a binary system;
the method is suitable for mass data storage;
the step S3 includes:
step S3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
step S3.2: adding the time difference value to the time length value expected to be cached to redis to obtain an expiration time value;
the step S4 includes: converting the acquired expiration time value into a character string, and adding 0 character to the left side of the character string until the length of the character string is equal to that of the set expiration time value when the length of the character string is less than that of the character string;
the step S6 includes: deleting the field by adopting an inert deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is inquired, carrying out overdue judgment in real time, if the value is overdue, discarding the value inquired at the time, returning to null, and deleting the filed.
2. The method for controlling field expiration for redis hash-type data according to claim 1, wherein the step S1 comprises: under the condition that the requirement of a service scene is met, the granularity setting of the time unit meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved.
3. The method of controlling field expiration for redis hash-type data of claim 1, further comprising: and supplementing a preset number to the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an expired control time value and a field without an expired control time value which is never expired so as to be compatible with the storage of the fields which are never expired.
4. A system for controlling field expiration for redis hash-type data, comprising:
a module M1: setting an expiration time unit and setting the length of a character string of an expiration time value;
a module M2: setting a reference time for overdue judgment, and defining a time value corresponding to the reference time as a 0 value;
a module M3: calculating an expected field expiration time value according to the string length of the expiration time value, the base time and the current time;
a module M4: the length of the character string of the expiration time value is filled to the length of the character string of the set expiration time value, and a new expiration value character string is obtained;
a module M5: splicing the new overdue value character string and the value according to the character string type to obtain a new value, and storing the new value serving as a hash value into redis; wherein, DAY or HOUR time unit is adopted;
a module M6: scanning a hash value of redis at regular time, and deleting the field when the difference value between the current time and the reference time is larger than the expiration time value extracted from the hash value;
when redis stores hash type data in a ziplist structure, integer numerical data is stored in a binary system;
when the original value is a number and the new value is filled with 0 characters, supplementing a number which is not 0 to the leftmost side of the current new value, and enabling the new value to be stored in redis still as an integer value; the number which is not 0 is 1, so that when the redis is stored, the number which is identified as an integer is stored in a binary system;
the method is suitable for mass data storage;
the module M3 comprises:
module M3.1: calculating the time difference between the current time and the reference time by using the set expiration time unit;
module M3.2: adding the time difference value to the time length value expected to be cached to redis to obtain an expiration time value;
the module M4 comprises: converting the obtained expiration time value into a character string, and adding 0 character on the left side of the character string when the length of the character string is smaller than the length of the character string of the set expiration time value until the lengths are equal;
the module M6 comprises: deleting the field by adopting an inert deleting mode;
the inert deletion mode comprises the following steps: and when the value of the filed is inquired, carrying out overdue judgment in real time, if the value is overdue, discarding the value inquired at the time, returning to null, and deleting the filed.
5. The system for controlling field expiration for redis hash-type data of claim 4, wherein the module M1 comprises: under the condition that the requirement of a service scene is met, the granularity setting of the time unit meets the preset condition, the character string length setting value of the expiration time value is reduced, and the space occupied by redis is saved.
6. The system for controlling field expiration for redis hash-type data of claim 5, further comprising: and supplementing a preset number to the leftmost side of the value for identification, and dividing the field corresponding to the value into a field with an expired control time value and a field without an expired control time value which is never expired so as to be compatible with the storage of the fields which are never expired.
CN202110605238.7A 2021-05-31 2021-05-31 Method and system for controlling field expiration aiming at redis hash type data Active CN113297192B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110605238.7A CN113297192B (en) 2021-05-31 2021-05-31 Method and system for controlling field expiration aiming at redis hash type data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110605238.7A CN113297192B (en) 2021-05-31 2021-05-31 Method and system for controlling field expiration aiming at redis hash type data

Publications (2)

Publication Number Publication Date
CN113297192A CN113297192A (en) 2021-08-24
CN113297192B true CN113297192B (en) 2023-03-14

Family

ID=77326535

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110605238.7A Active CN113297192B (en) 2021-05-31 2021-05-31 Method and system for controlling field expiration aiming at redis hash type data

Country Status (1)

Country Link
CN (1) CN113297192B (en)

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105426451A (en) * 2015-11-11 2016-03-23 深圳市华讯方舟科技有限公司 Key value pair-based data processing method and system
CN106126356A (en) * 2016-06-24 2016-11-16 努比亚技术有限公司 The realization of a kind of server buffer, generation method and system
CN108196792B (en) * 2017-12-29 2021-06-01 北京奇虎科技有限公司 Method and device for clearing expired data
CN110399371B (en) * 2018-04-23 2023-06-23 湖南湘谷信息科技有限公司 Redis database-based memory consumption reduction method, storage medium and device
CN109241128B (en) * 2018-07-16 2021-05-14 北京百度网讯科技有限公司 Automatic triggering method and system for overdue event
CN109101635B (en) * 2018-08-16 2020-09-11 广州小鹏汽车科技有限公司 Data processing method and device based on Redis Hash structure
CN110895524B (en) * 2018-08-24 2022-06-21 武汉斗鱼网络科技有限公司 Composite overdue method, device, server and storage medium of full-load redis time key
CN109344296B (en) * 2018-08-30 2021-11-26 武汉斗鱼网络科技有限公司 Domain lifecycle control method, system, server and storage medium for implementing HASH key of Redis
US10657064B1 (en) * 2019-01-31 2020-05-19 Salesforce.com. inc. Extending usages of cached data objects beyond cache expiration periods
CN110532284B (en) * 2019-09-06 2023-05-23 深圳前海环融联易信息科技服务有限公司 Mass data storage and retrieval method and device, computer equipment and storage medium
CN112347134B (en) * 2020-11-05 2023-05-30 平安科技(深圳)有限公司 Redis cache management method, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113297192A (en) 2021-08-24

Similar Documents

Publication Publication Date Title
US10776263B2 (en) Non-deterministic window scheduling for data storage systems
CN109857737B (en) Cold and hot data storage method and device and electronic equipment
CN107133234B (en) Method, device and system for updating cache data
CN109271435B (en) Data extraction method and system supporting breakpoint continuous transmission
EP3361409B1 (en) Data deduplication method and apparatus
CN106570093B (en) Mass data migration method and device based on independent metadata organization structure
KR20180046377A (en) Storage tier with compressed forward map
CN105138416A (en) Disk sleep processing method and apparatus
CN105511806A (en) Method for processing write request and mobile terminal
CN114218238A (en) Data storage method, system and application for recording complete change information of data
CN113297192B (en) Method and system for controlling field expiration aiming at redis hash type data
US20230252029A1 (en) On-board data storage method and system
CN109725841B (en) Data writing method, device, storage system, storage medium and controller
CN110908429B (en) Timer operation method and device
US20200004636A1 (en) Data Storage System with Strategic Contention Avoidance
CN111736778B (en) Data updating method, device and system and electronic equipment
CN107908370A (en) Date storage method and device
CN111126004A (en) Method, device and equipment for generating product sequence code and computer readable storage medium
CN112468980A (en) Short message reminding fusing processing method and system based on distributed memory database
CN110866068A (en) Announcement data storage method and device based on HDFS
CN112835716B (en) CPU buffer allocation method and terminal of 5G communication virtualization network element
CN112235332A (en) Read-write switching method and device for cluster
CN110888588A (en) Flash memory controller and related access method and electronic device
CN113239061B (en) Intelligent court data updating method and system
KR101221992B1 (en) Apparatus for logging data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant