CN110019263B - Information storage method and device - Google Patents

Information storage method and device Download PDF

Info

Publication number
CN110019263B
CN110019263B CN201710972691.5A CN201710972691A CN110019263B CN 110019263 B CN110019263 B CN 110019263B CN 201710972691 A CN201710972691 A CN 201710972691A CN 110019263 B CN110019263 B CN 110019263B
Authority
CN
China
Prior art keywords
key
information
value pair
expiration time
value
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
CN201710972691.5A
Other languages
Chinese (zh)
Other versions
CN110019263A (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710972691.5A priority Critical patent/CN110019263B/en
Publication of CN110019263A publication Critical patent/CN110019263A/en
Application granted granted Critical
Publication of CN110019263B publication Critical patent/CN110019263B/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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Abstract

The embodiment of the application discloses an information storage method and device. One embodiment of the method comprises: receiving an information storage request, wherein the information storage request comprises a key-value pair, an expiration time and object information of a specified object; storing the key value pair into a cache region, and setting an expiration time value of the key value pair in the cache region according to the expiration time; and correspondingly classifying the keys of the key value pairs and the expiration time into an information set associated with the object information, and storing the information set into the cache region. When the object information changes, the cached information can be accurately deleted, so that the wrong deletion of the information is avoided, and the consistency of the data in the database and the cache area is ensured.

Description

Information storage method and device
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for storing information.
Background
In order to improve the performance of the query interface of the system, information in the database can be cached in a cache region. In this way, queries can be made directly in the cache. Generally, when data in a database changes, all relevant data in a cache needs to be deleted in order to maintain the consistency of the data.
In the prior art, deleting the relevant data in the cache requires a technician to write the specific content to be deleted in the development stage. Therefore, the relationship between the data and the cache is implemented by hard coding the program. After a program has undergone several iterations to add or delete some caches, it is easy to cause data inconsistency between the database and the cache area due to the fact that some cache information is deleted by mistake, for example, some cache information is missed or deleted more.
Disclosure of Invention
An object of the embodiments of the present application is to provide an improved information storage method and apparatus, so as to solve the technical problems mentioned in the above background.
In a first aspect, an embodiment of the present application provides an information storage method, where the method includes: receiving an information storage request, wherein the information storage request comprises a key value pair, an expiration time and object information of a specified object; storing the key value pair into a cache region, and setting an expiration time value of the key value pair in the cache region according to the expiration time; and correspondingly classifying the keys of the key value pairs and the expiration time into an information set associated with the object information, and storing the information set into a cache region.
In some embodiments, after storing the set of information in the buffer, the method further comprises: in response to receiving a delete request for cached information for a specified object, an information set associated with the object information is determined.
In some embodiments, the number of key-value pairs is at least two; and after determining the information set associated with the object information, the method further comprises: acquiring the corresponding expiration time of each key value pair in the information set associated with the object information; for each key of the key-value pair, determining whether an expiration time corresponding to the key of the key-value pair has been reached; in response to determining that the key-value pair has not arrived, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
In some embodiments, after deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache, the method further comprises: and deleting the information set associated with the object information from the cache region.
In some embodiments, the object information includes an object identification.
In some embodiments, attributing the key and expiration time correspondence of a key-value pair to a set of information associated with object information includes: splicing the keys of the key value pairs and the expiration time by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into an information set associated with the object information.
In a second aspect, an embodiment of the present application provides an information storage apparatus, including: a receiving unit configured to receive an information storage request, wherein the information storage request includes a key-value pair, an expiration time, and object information of a specified object; the setting unit is configured to store the key value pair into the cache region and set an expiration time value of the key value pair in the cache region according to the expiration time; and the storage unit is configured to correspondingly put the keys of the key value pairs and the expiration time into an information set associated with the object information and store the information set into the cache region.
In some embodiments, the apparatus further comprises: and the determining unit is configured to determine the information set associated with the object information in response to receiving a deletion request of the cache information of the specified object.
In some embodiments, the number of key-value pairs is at least two; and the apparatus further comprises: the acquiring unit is used for acquiring the corresponding expiration time of each key value pair in the information set associated with the object information; a deleting unit configured to determine, for each key of a key-value pair, whether an expiration time corresponding to the key of the key-value pair has arrived; in response to determining that the key-value pair has not arrived, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
In some embodiments, the apparatus further comprises: and the set deleting unit is configured to delete the information set associated with the object information from the cache region.
In some embodiments, the object information includes an object identification.
In some embodiments, the memory unit is further configured to: splicing the keys of the key value pairs and the expiration time by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into an information set associated with the object information.
In a third aspect, an embodiment of the present application provides a server, including: one or more processors; a storage device for storing one or more programs which, when executed by one or more processors, cause the one or more processors to implement a method as in any embodiment of the information storage method.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the computer program implements a method as in any one of the information storage methods.
According to the information storage method and the information storage device, the information storage request is received, wherein the information storage request comprises the key value pair, the expiration time and the object information of the specified object. And then storing the key value pair into a cache region, and setting the expiration time value of the key value pair in the cache region according to the expiration time. And finally, correspondingly classifying the keys of the key value pairs and the expiration time into an information set associated with the object information, and storing the information set into a cache region. When the object information changes, the cached information can be accurately deleted, so that the wrong deletion of the information is avoided, and the consistency of the data in the database and the cache area is ensured.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of an information storage method according to the present application;
FIG. 3 is a schematic diagram of an application scenario of an information storage method according to the present application;
FIG. 4 is a flow diagram of yet another embodiment of an information storage method according to the present application;
FIG. 5 is a schematic block diagram of one embodiment of an information storage device according to the present application;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing a server according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
FIG. 1 illustrates an exemplary system architecture 100 to which embodiments of the information storage method or information storage apparatus of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture Experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop and desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background server that provides support for content displayed on the terminal devices 101, 102, 103. The background server can analyze and process the received data such as the information storage request and feed back the processing result to the terminal equipment.
It should be noted that the information storage method provided in the embodiment of the present application is generally executed by the server 105, and accordingly, the information storage device is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of an information storage method according to the present application is shown. The information storage method comprises the following steps:
step 201, an information storage request is received.
In this embodiment, an electronic device (for example, a server shown in fig. 1) on which the information storage method operates may receive an information storage request from another electronic device through a wired connection manner or a wireless connection manner. Wherein the information storage request includes key-value pairs (key and value), an expiration time, and object information of the specified object. The key-value pairs, expiration times, and object information, which are typically included in an information storage request, are content associated with the same object. Here, the information storage request may include one piece of information, which is a group of related key value pairs, expiration time, and object information, or may include multiple pieces of information.
The information storage request is a request sent to the electronic equipment and used for the electronic equipment to perform information storage operation. Specifically, the cache memory may be stored in a local cache memory, or may be stored in a cache memory of other electronic devices. The expiration time herein refers to the expiration time of the key-value pair in the information storage request. The object is an object obtained by instantiating a class in the object-oriented programming. For example, the item model may be abstracted into a class, and a certain item model numbered 1 is an object, and a certain item model numbered 2 is also an object. The object information is information related to an object, and object information of different objects is different. The designated object may be an artificially defined object or an object that is machine-generated or set.
In some optional implementation manners of this embodiment, the object information includes an object identifier.
In this embodiment, the object identifier is an identifier for distinguishing an object. The object identifier may be composed of a class name and an object number to which the object belongs.
Step 202, storing the key-value pair into a buffer area, and setting an expiration time value of the key-value pair in the buffer area according to the expiration time.
In this embodiment, the key value pair is the content to be stored by the electronic device. The electronic equipment stores the key value pair in the information storage request into the cache region, and sets the expiration time value of the key value pair stored in the cache region. The expiration time value is a value of an expiration time set in the cache. In particular, the value of the expiration time in the information storage request may be set to the expiration time value of the key-value pair in the cache. For example, the expiration time in the information storage request may be 2017/05/16, 01:02:30, which may be used as the expiration time value for the key-value pair in the cache.
The cache region may be a database with a caching function, such as a redis database.
Step 203, correspondingly classifying the keys of the key value pairs and the expiration time into an information set associated with the object information, and storing the information set into a cache region.
In this embodiment, the electronic device classifies the key of the key-value pair and the expiration time into an information set, and then stores the information set in a buffer. The information set is a set for collecting information and is associated with the object information. The information set may be pre-established or newly created for the key and expiration time of the key-value pair currently stored. Specifically, if the information set associated with the object information is already established in the cache area before the information storage request is received this time, the key and the expiration time of the key-value pair may be stored in the pre-established information set. If the information set associated with the object information is not established before, an information set associated with the object information needs to be established.
The object information of each object has an associated information set, and the object information of different objects is associated with different information sets.
After the key and expiration time of the key-value pair are correspondingly included in the information set, the key and expiration time of the key-value pair having a corresponding relationship are included in the information set. The key-value pair in the cache region can be searched relatively quickly through the key-value pair.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the information storage method according to the present embodiment. In the application scenario of fig. 3, the electronic device 302 receives an information storage request 303 from the other electronic device 301, wherein the information storage request 303 comprises key-value pairs, expiration times 2017/03/05, 03:02:00, and object information of specified objects. Then, the electronic device 302 stores the key-value pair into a buffer, and sets an expiration time value 304 of the key-value pair in the buffer according to the expiration time; finally, the electronic device classifies the key of the key-value pair and the expiration time into an information set 305 associated with the object information, and stores the information set in a buffer 306.
According to the method provided by the embodiment of the application, the keys and the expiration times of the key value pairs are correspondingly classified into the information set associated with the object information, so that the key value pairs in the information set associated with the object information can be conveniently and accurately determined and deleted, the information is prevented from being deleted more or omitted, the consistency of the data in the database and the cache region is ensured, and the expandability of the system is improved.
With further reference to FIG. 4, a flow 400 of yet another embodiment of an information storage method is shown. The process 400 of the information storage method includes the following steps:
step 401, an information storage request is received.
In this embodiment, the server on which the information storage method operates may receive the information storage request from the other electronic device by a wired connection manner or a wireless connection manner. Wherein the information storage request includes a key-value pair (key and value), an expiration time, and object information. The key-value pairs, expiration times, and object information, which are typically included in an information storage request, are content associated with the same object. Here, the information storage request may include one piece of information, which is a group of related key value pairs, expiration time, and object information, or may include multiple pieces of information.
The information storage request is a request sent to the server to enable the server to perform information storage operation. Specifically, the cache memory may be stored in a local cache memory, or may be stored in a cache memory of other electronic devices. The expiration time herein refers to the expiration time of the key-value pair in the information storage request. An object is an object that results from instantiating a class in object-oriented programming. For example, the item model may be abstracted into a class, and a certain item model numbered 1 is an object, and a certain item model numbered 2 is also an object. The object information is information related to an object, and object information of different objects is different.
Step 402, storing the key-value pair into a buffer area, and setting an expiration time value of the key-value pair in the buffer area according to the expiration time.
In this embodiment, the key value pair is the content to be stored by the server. And the server stores the key value pair in the storage request into the cache region and sets the value of the expiration time of the key value pair stored in the cache region. The expiration time value is a value of an expiration time set in the cache. In particular, the value of the expiration time in the information storage request may be set to the expiration time value of the key-value pair in the cache. For example, the expiration time in the information storage request may be 2017/05/16, 01:02:30, which may be used as the expiration time value for the key-value pair in the cache.
Step 403, splicing the keys of the key-value pairs and the expiration time by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into an information set associated with the object information.
In this embodiment, the server concatenates the keys of the key-value pairs and the expiration times, and puts the keys of the concatenated key-value pairs and the expiration times into the information set. The set of information is, and is associated with, object information. The spliced key and the expiration time have direct correspondence. In particular, the concatenation may be performed using a separator "-", i.e. a separator is used to connect the key and the expiry time.
Step 404, store the information set in the buffer.
In this embodiment, after obtaining the information set including the key of the corresponding key-value pair and the expiration time, the server stores the obtained information set in the cache region, so as to modify or delete the key-value pair through the key of the key-value pair in the following process.
In response to receiving a delete request for the cache information of the specified object, an information set associated with the object information is determined, step 405.
In this embodiment, the server responds, after receiving a deletion request for the cache information of the specified object: an information set associated with the object information of the specified object is determined. The deletion request here is a request for information of a specified object. The cache information of the specified object is information about the specified object that has been stored in the cache area. For example, the information set may include information sets related to object information of the object, or may be key-value pairs corresponding to keys of the key-value pairs in the information set.
Step 406, obtaining the expiration time corresponding to the key of each key-value pair in the information set associated with the object information.
In this embodiment, the number of key-value pairs may be at least two. That is, the number of keys of the key-value pair in the information set associated with the object information of each object is at least two. The server acquires the expiration time corresponding to the key of each key value pair in the information set associated with the object information of the specified object, so as to conveniently determine whether the expiration time is reached or not in the following process.
Step 407, for each key of the key-value pair, determine whether the expiration time corresponding to the key of the key-value pair has been reached.
In this embodiment, for each key of a key-value pair, the server determines whether the expiration time corresponding to the key of the key-value pair has been reached. Because the keys of the key-value pairs and the expiration times are correspondingly stored in the information set in a splicing mode, the expiration times can be obtained through the keys of the key-value pairs. And further determines whether the current time has reached the acquired expiration time.
Specifically, the server may traverse the key of each key-value pair in the information set, obtain the expiration time corresponding to each key through parsing, and determine whether the expiration time obtained through parsing has been reached.
Step 408, for each key of the key-value pair, in response to determining that the key does not arrive, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
In this embodiment, for each key of a key-value pair, the server responds after determining that the expiration time has not been reached: the key of the key-value pair and the value corresponding to the key of the key-value pair are deleted from the cache. That is, if it is determined that the expiration time has not been reached, the system does not perform an automatic deletion operation, but because a deletion request for the cached information is received, the server deletes the key of the key-value pair and the value in the key-value pair corresponding to the key of the key-value pair. In this way, cached key-value pairs may be deleted by their keys.
If the server determines that the expiration time has been reached, take the cache as a redis database as an example. The redis database in the server or the redis databases of other electronic devices in the device combination where the server is located may automatically delete the key-value pair in the cache region, where the expiration time value is set, after determining that the expiration time value is reached.
Step 409, deleting the information set associated with the object information from the cache.
In this embodiment, after deleting the key-value pair in the cache region, the information set associated with the object information is deleted to empty all the cache information about the object in the cache region.
In the embodiment, when the expiration time is not reached, the key value pair associated with the object is deleted through the key of the key value pair in the information set associated with the object information, so that the information deletion is performed more accurately.
With further reference to fig. 5, as an implementation of the method shown in the above figures, the present application provides an embodiment of an information storage apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied to various electronic devices.
As shown in fig. 5, the information storage apparatus 500 of the present embodiment includes: a receiving unit 501, a setting unit 502, and a storage unit 503. The receiving unit 501 is configured to receive an information storage request, where the information storage request includes a key value pair, an expiration time, and object information of a specified object; a setting unit 502 configured to store the key-value pair into a buffer, and set an expiration time value of the key-value pair in the buffer according to the expiration time; the storage unit 503 is configured to correspondingly classify the key of the key-value pair and the expiration time into an information set associated with the object information, and store the information set in the cache region.
In this embodiment, the receiving unit 501 may receive the information storage request from the other electronic device by a wired connection manner or a wireless connection manner. Wherein the information storage request includes key-value pairs (key and value), an expiration time, and object information of the specified object. The key-value pairs, expiration times, and object information, which are typically included in an information storage request, are content associated with the same object. Here, the information storage request may include one piece of information, which is a group of related key value pairs, expiration time, and object information, or may include multiple pieces of information.
In this embodiment, the key value pair is the content to be stored by the electronic device. The setting unit 502 stores the key-value pair in the storage request into the buffer, and sets an expiration time value of the key-value pair stored in the buffer. The expiration time value is a value of an expiration time set in the cache. In particular, the value of the expiration time in the information storage request may be set to the expiration time value of the key-value pair in the cache. For example, the expiration time in the information storage request may be 2017/05/16, 01:02:30, which may be used as the expiration time value for the key-value pair in the cache.
In this embodiment, the storage unit 503 classifies the key and the expiration time of the key-value pair into the information set, and then stores the information set in the buffer. The information set is a set for collecting information and is associated with the object information. The object information of each object has an associated information set, and the object information of different objects is associated with different information sets.
In some optional implementations of this embodiment, the apparatus further includes: and the determining unit is configured to determine the information set associated with the object information in response to receiving a deletion request of the cache information of the specified object.
In some optional implementations of this embodiment, the number of key-value pairs is at least two; and the apparatus further comprises: the acquiring unit is used for acquiring the corresponding expiration time of each key value pair in the information set associated with the object information; a deleting unit configured to determine, for each key of a key-value pair, whether an expiration time corresponding to the key of the key-value pair has arrived; in response to determining that the key-value pair has not arrived, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
In some optional implementations of this embodiment, the apparatus further includes: and the set deleting unit is configured to delete the information set associated with the object information from the cache region.
In some optional implementation manners of this embodiment, the object information includes an object identifier.
In some optional implementations of this embodiment, the storage unit is further configured to: splicing the keys of the key value pairs and the expiration time by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into an information set associated with the object information.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a server according to embodiments of the present application. The server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable medium of the present application can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit, a setting unit, and a storage unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, a receiving unit may also be described as a "unit that receives an information storage request".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: receiving an information storage request, wherein the information storage request comprises a key value pair, an expiration time and object information of a specified object; storing the key value pair into a cache region, and setting an expiration time value of the key value pair in the cache region according to the expiration time; and correspondingly classifying the keys of the key value pairs and the expiration time into an information set associated with the object information, and storing the information set into a cache region.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (12)

1. An information storage method, the method comprising:
receiving an information storage request, wherein the information storage request comprises a key-value pair, an expiration time and object information of a specified object;
storing the key value pair into a cache region, and setting an expiration time value of the key value pair in the cache region according to the expiration time;
correspondingly classifying the keys of the key-value pairs and the expiration time into an information set associated with the object information, and storing the information set into the cache region;
after the storing the set of information into the cache, the method further comprises:
in response to receiving a deletion request for the cache information of the specified object, determining an information set associated with the object information;
after the determining the set of information associated with the object information, the method further comprises:
acquiring the corresponding expiration time of each key value pair in the information set associated with the object information; for each key of the key-value pair, determining whether an expiration time corresponding to the key of the key-value pair has been reached; in response to determining that the key-value pair has not been reached, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
2. The information storage method of claim 1, wherein the number of key-value pairs is at least two.
3. The information storage method of claim 1, wherein after deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache, the method further comprises:
and deleting the information set associated with the object information from the cache region.
4. The information storage method according to claim 1, wherein the object information includes an object identifier.
5. The information storage method according to any one of claims 1 to 4, wherein said assigning the key of the key-value pair and the expiration time correspondence to an information set associated with the object information comprises:
splicing the keys of the key-value pairs and the expiration times by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into the information set associated with the object information.
6. An information storage apparatus, characterized in that the apparatus comprises:
a receiving unit configured to receive an information storage request, wherein the information storage request includes a key-value pair, an expiration time, and object information of a specified object;
the setting unit is configured to store the key value pair into a cache region and set an expiration time value of the key value pair in the cache region according to the expiration time;
the storage unit is configured to correspondingly classify the keys of the key-value pairs and the expiration time into an information set associated with the object information, and store the information set into the cache region;
the device further comprises:
a determining unit configured to determine an information set associated with the object information in response to receiving a deletion request for the cache information of the specified object;
the device further comprises:
the acquisition unit is configured to acquire the expiration time corresponding to the key of each key-value pair in the information set associated with the object information; a deleting unit configured to determine, for each key of a key-value pair, whether an expiration time corresponding to the key of the key-value pair has arrived; in response to determining that the key-value pair has not been reached, deleting the key of the key-value pair and the value corresponding to the key of the key-value pair from the cache.
7. The information storage device of claim 6, wherein the number of key-value pairs is at least two.
8. The information storage device of claim 6, further comprising:
and the set deleting unit is configured to delete the information set associated with the object information from the cache region.
9. The information storage device of claim 6, wherein the object information includes an object identifier.
10. The information storage device of claim 7, wherein the storage unit is further configured to:
splicing the keys of the key-value pairs and the expiration times by using separators; and classifying the keys and the expiration times of the spliced key-value pairs into the information set associated with the object information.
11. A server, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201710972691.5A 2017-10-18 2017-10-18 Information storage method and device Active CN110019263B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710972691.5A CN110019263B (en) 2017-10-18 2017-10-18 Information storage method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710972691.5A CN110019263B (en) 2017-10-18 2017-10-18 Information storage method and device

Publications (2)

Publication Number Publication Date
CN110019263A CN110019263A (en) 2019-07-16
CN110019263B true CN110019263B (en) 2021-08-13

Family

ID=67186643

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710972691.5A Active CN110019263B (en) 2017-10-18 2017-10-18 Information storage method and device

Country Status (1)

Country Link
CN (1) CN110019263B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110417908B (en) * 2019-08-05 2021-09-28 空气管家(北京)科技有限公司 Internet of things cloud startup and shutdown control method and system
CN110750566A (en) * 2019-10-24 2020-02-04 广州欢聊网络科技有限公司 Data processing method and device, cache system and cache management platform
CN111737297B (en) * 2020-06-15 2023-08-25 中国工商银行股份有限公司 Method and device for processing link aggregation call information
CN112214503A (en) * 2020-10-10 2021-01-12 深圳壹账通智能科技有限公司 Data processing method and device, electronic equipment and storage medium
CN112910983A (en) * 2021-01-27 2021-06-04 北京百度网讯科技有限公司 Message pushing method, device, equipment and medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001298746A (en) * 2000-03-09 2001-10-26 Samsung Techwin Co Ltd Data compressor for digital recording system and its control method
JP4621747B2 (en) * 2008-02-15 2011-01-26 株式会社東芝 Communication control apparatus and information processing apparatus
CN102542034B (en) * 2011-12-23 2015-09-09 北京人大金仓信息技术股份有限公司 A kind of result set cache method of database interface
CN103312733B (en) * 2012-03-08 2016-03-02 腾讯科技(深圳)有限公司 Information processing method and device
CN102902730B (en) * 2012-09-10 2016-04-20 新浪网技术(中国)有限公司 Based on data reading method and the device of data buffer storage
CN104239776B (en) * 2014-09-23 2018-04-20 浪潮(北京)电子信息产业有限公司 More controlled storage system single-point logging methods and more controlled storage systems
CN104580226B (en) * 2015-01-15 2017-07-11 上海瀚之友信息技术服务有限公司 A kind of system and method for shared session data

Also Published As

Publication number Publication date
CN110019263A (en) 2019-07-16

Similar Documents

Publication Publication Date Title
CN110019263B (en) Information storage method and device
CN107423085B (en) Method and apparatus for deploying applications
CN108011949B (en) Method and apparatus for acquiring data
CN110737726B (en) Method and device for determining test data of interface to be tested
CN107347093B (en) Configuration method and device for distributed server system
CN109218041B (en) Request processing method and device for server system
CN109409419B (en) Method and apparatus for processing data
CN114297278A (en) Method, system and device for quickly writing batch data
CN112433713A (en) Application program design graph processing method and device
CN112100168A (en) Method and device for determining data association relationship
CN111367500A (en) Data processing method and device
CN109087097B (en) Method and device for updating same identifier of chain code
CN114064803A (en) Data synchronization method and device
CN112711572A (en) Online capacity expansion method and device suitable for sub-warehouse and sub-meter
CN112988583A (en) Method and device for testing syntax compatibility of database
CN113742321A (en) Data updating method and device
CN108628909B (en) Information pushing method and device
CN112860538A (en) Method and device for performing interface regression test based on online log
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN110851192A (en) Method and device for responding to configuration of degraded switch
CN112527802B (en) Soft link method and device based on key value database
CN109840196B (en) Method and device for testing business logic
CN113297087A (en) Test method and device
CN110895584B (en) Method and apparatus for generating data
CN113778909B (en) Method and device for caching 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