CN105468707A - Cache-based data processing method and device - Google Patents

Cache-based data processing method and device Download PDF

Info

Publication number
CN105468707A
CN105468707A CN201510799849.4A CN201510799849A CN105468707A CN 105468707 A CN105468707 A CN 105468707A CN 201510799849 A CN201510799849 A CN 201510799849A CN 105468707 A CN105468707 A CN 105468707A
Authority
CN
China
Prior art keywords
data
buffer
stored
client
matched
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.)
Pending
Application number
CN201510799849.4A
Other languages
Chinese (zh)
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 Ruian Technology Co Ltd
Original Assignee
Beijing Ruian 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 Ruian Technology Co Ltd filed Critical Beijing Ruian Technology Co Ltd
Priority to CN201510799849.4A priority Critical patent/CN105468707A/en
Publication of CN105468707A publication Critical patent/CN105468707A/en
Pending legal-status Critical Current

Links

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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Embodiments of the invention provide a cache-based data processing method and device. The method comprises the following steps of judging whether data matched with a data processing request exists in a buffer according to the data processing request received from a client; if the data matched with the data processing request exists in the buffer, obtaining the matched data from the buffer, otherwise obtaining the data matched with the data processing request from a preset database and sending the data obtained from the database to the buffer in order to enable the buffer to store the received data; and sending the obtained matched data to the client. According to the embodiments of the invention, by adopting the technical scheme, the time for sending the data is saved and the response speed of the client is improved, and furthermore, the hardware resources can be also saved, so that the limited hardware resources can serve more users.

Description

Data processing method and device based on cache
Technical Field
The present invention relates to the field of data storage, and in particular, to a data processing method and apparatus based on a cache.
Background
With the development of information technology, the internet becomes an essential part in daily life and work of people, and people need to communicate and browse web pages to know knowledge and news through the internet through chatting software.
In general, the general operation mode of a website or an application is: the browser sends a data request to the application server, the application server performs operation according to the request and sends the request to the database, the database performs operation again according to the request, and the data are returned to the browser after the operation is completed. With the popularization of the internet, the number of people who surf the internet and the information amount on the internet are in a trend of obviously increasing, so that one application needs to support more and more concurrent amounts, and further, the operation amount of an application server and a database server of the application is increased day by day. However, the server resources of each application are often limited, the number of times the database receives requests per second is also limited, and in the case of large data traffic, the limitation of the server resources and the database resources causes each application to require more hardware resources and longer application response time, resulting in waste of time and excessive consumption of hardware resources.
Disclosure of Invention
In view of this, embodiments of the present invention provide a data processing method and apparatus based on a cache, so as to solve the problems of a slow network operation speed and excessive consumption of server hardware resources in the prior art.
In a first aspect, an embodiment of the present invention provides a data processing method based on a cache, including:
judging whether data matched with the data processing request exists in a buffer according to the data processing request received from the client;
if the data matched with the data processing request exists in the buffer, acquiring the matched data from the buffer; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data;
and sending the acquired matched data to the client.
In a second aspect, an embodiment of the present invention further provides a data processing apparatus based on a cache, including:
the data judgment module is used for judging whether data matched with the data processing request exists in the buffer according to the data processing request received from the client;
the data acquisition module is used for acquiring matched data from the buffer if the data matched with the data processing request exists in the buffer; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data;
and the data sending module is used for sending the acquired matched data to the client.
According to the data processing scheme based on the cache, when a server receives a data processing request sent by a client, whether data matched with the data processing request exists in the cache, namely requested data, is judged firstly, if the requested data exists in the cache, the requested data is called from the cache and sent to the client, otherwise, the requested data is obtained from a database and sent to the client, and the requested data is synchronized into the cache, namely, when the client sends the data request, the server calls the requested data from the cache firstly, and when the requested data does not exist in the cache, the requested data is called from the database, so that the time required by the server to call the data can be effectively saved, the response speed of the client to send the data request is improved, and the waiting time of a user is reduced, the user experience is improved, the hardware resources can be saved, more customers can be served by the limited hardware resources, and the cost for expanding the hardware resources is reduced.
Drawings
Other features, objects and advantages of the invention will become more apparent upon reading of the detailed description of non-limiting embodiments made with reference to the following drawings:
fig. 1 is a schematic flowchart of a data processing method based on a cache according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data processing method based on a cache according to a second embodiment of the present invention;
fig. 3 is a schematic flowchart of a data storage method based on a cache according to a second embodiment of the present invention;
fig. 4 is a block diagram of a data processing apparatus based on a cache according to a third embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure, and in some alternative implementations, the functions/acts noted may occur out of the order noted in the figures. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
An embodiment of the present invention provides a cache-based data processing method, which may be executed by a cache-based data processing apparatus provided in an embodiment of the present invention, and fig. 1 is a schematic flow diagram of the cache-based data processing method provided in the embodiment of the present invention, as shown in fig. 1, the method includes:
s110, judging whether data matched with the data processing request exists in the buffer according to the data processing request received from the client.
The client refers to an application program capable of sending a data request and/or performing data processing, and the client may be disposed in an intelligent terminal such as a mobile phone, a tablet computer, a notebook computer, a desktop computer, and the like. Specifically, the server determines whether data matching the data processing request exists in the buffer according to the data processing request received from the client, the server may be a terminal device other than the intelligent terminal to which the client belongs, or an intelligent terminal to which the client belongs, and the buffer may be disposed in the server. When the server is a terminal device except the intelligent terminal to which the client belongs, the server can be an intranet server or an extranet server; when the server is the intelligent terminal to which the client belongs, the server may be a processor of the intelligent terminal to which the client belongs. The following description mainly takes the server as a terminal device other than the intelligent terminal to which the client belongs as an example.
The data requested to be processed by the client can be simple numbers, and can also be files in other forms such as characters, images, sounds and the like. The data processing request sent by the client may include a unique key of the requested data, the unique key may be used to identify different data, the unique key corresponding to each data should be unique, and each unique key may also be used to identify only one data, so as to facilitate subsequent processing of the data.
The server judges whether the requested data exists in the buffer or not according to the unique key word of the requested data contained in the data processing request, if the unique key word exists in the buffer, the requested data exists in the buffer, and otherwise, the requested data does not exist in the buffer.
S120, if the data matched with the data processing request exists in the buffer, acquiring the matched data from the buffer; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data.
When the server is the intelligent terminal to which the client belongs, the database refers to the actual storage space of the intelligent terminal to which the client belongs; when the server is not the intelligent terminal to which the client belongs, the database can be arranged in the server.
Preferably, the buffer may store the received data in the form of key value pairs (key, value), wherein key represents a unique key of the data, and value represents the content to be stored. The format of the unique key words of the data is arbitrary, and a user can set the unique key words according to the needs, for example, the user can define a class according to the needs or habits of the user and write a section of program according to the rules of the user to define the format of the unique key words; the format of the data unique key may also be assigned by the server according to its default format, which is not limited herein.
For example, the format of the data unique key may be set to a form of a character string + time, wherein the time may be the time when the buffer stores the data, and the character string is a string of characters composed of data, letters and/or underlines to distinguish different data stored at the same time. For example, if a data is stored in the buffer at 2015 year 11, month 5, day 14, 10 minutes 36 seconds, and the data is stored at 2015 year 11, month 5, day 14, 10 minutes 36 seconds, then the format of the unique key of the data may be 00005_ 20151105141036.
For example, if the cache is found to have the requested data after judgment, the requested data can be searched and obtained according to the unique keyword contained in the data processing request; if the cache is judged to have no requested data, the requested data is called from the database by adopting a traditional data calling method, namely, the server requests the database through a corresponding algorithm, and the database receives the request and then sends the data to the server through corresponding calculation. Preferably, the buffer stores the received data while recording the time the data was stored in the buffer.
And S130, sending the acquired matched data to the client.
When the server is not the intelligent terminal to which the client belongs, the server is in accordance with a transmission control protocol/internet protocol (TCP/IP) when sending the requested data to the client, wherein the TCP is responsible for discovering the problem of transmission and sending a signal to request retransmission until all data are safely and correctly transmitted to the destination after discovering the problem; the internet protocol is responsible for specifying an IP address for each networked device on the internet. The server can send the requested data to the client through a wired network or a wireless network, wherein the wired network can be an Ethernet; the wireless network includes networks such as a personal area network, a local area network, a metropolitan area network, and the like, and common wireless networks include bluetooth, a Wireless Local Area Network (WLAN), and the like.
For example, the cache-based data processing method provided by the embodiment of the present invention may be implemented by programming. Firstly, defining a similar MyCache, defining two static mappings (maps) in the MyCache, wherein one mapping can be named as dataMap and is used for storing the content of data; another map may be named dateMap to store the expiration time of the corresponding data. When the two mappings store related content of the same data, the corresponding key values of the data in the two mappings are unique. Secondly, define the function in the class MyCache, and the defined function may include: data storage function put (Stringkey, Objectobject, intdays), data acquisition function get (Stringkey), data judgment function isexistkey (Stringkey). Wherein, the key represents a unique key of the stored data; object represents the content of the stored data; days represents the storage duration of the stored data; string, Object and int represent types of data stored in functions, String is a character String and represents that key stored in the String is in a character String format, Object is an Object and represents that Object stored in the String is in an Object type, int is a reshaping and represents that days stored in the String is an integer.
Correspondingly, the execution process of the data processing method based on the cache provided by the embodiment of the invention can be as follows:
a1, calling a data judgment function isExistKey (Stringkey) according to a unique key contained in a data processing request received from a client to judge whether data matched with the data processing request exists in a buffer, if the returned value is true, indicating that the key value exists, namely the requested data exists in the buffer, executing step b 1; if the return value is false, it indicates that the key value does not exist, i.e. the requested data does not exist in the buffer, step c1 is executed.
The judgment process of the data judgment function isExistKey (Stringkey) may be: calling a data acquisition function get (Stringkey) for mapping the dataMap, if the returned object is not empty, indicating that the key value exists, and returning a true value by a data judgment function (isExistKey (Stringkey)) at the moment; if the object returned by the data obtaining function get (stringkey) is empty, it indicates that the key value does not exist, and at this time, the data judging function isexistkey (stringkey) returns a "false" value.
b1, calling the data get function get (Stringkey) in the class to get the requested data, namely: the get function of the dataMap map is called to return the obtained value to the server, and step d1 is performed.
c1, obtaining the requested data from the database, and calling the data storage function put (Stringkey, Objectobject, intdays) to store the requested data in the buffer memory, that is: obtaining dataMap mapping and dataMap mapping in the MyCache class; calling a put function mapped by the dataMap, and storing data into a buffer; the put function calling the datamap map stores the expiration date of the requested data into the buffer by using the same key value (the storage duration days of the requested data is converted into a specific date after being calculated), and the step d1 is continuously executed.
d1, sending the acquired requested data to the corresponding client, and finishing the operation.
According to the technical scheme provided by the first embodiment of the invention, when a data request sent by a client is received, a server firstly judges whether requested data exists in a buffer, if the requested data exists in the buffer, the requested data is directly called from the buffer and sent to the client; if not, the requested data is called from the database, sent to the buffer memory to enable the buffer memory to store the received data and simultaneously sent to the corresponding client. By adopting the technical scheme, when the client sends a data request, the server firstly calls the requested data from the cache, and when the requested data does not exist in the cache, the requested data is called from the database, so that the time required by the server to call the data can be saved, the response speed of the client sending the data request can be improved, the waiting time of a user can be reduced, the user experience can be improved, the hardware resources can be saved, more clients can be served by limited resources, and the cost required by expanding the hardware resources can be reduced.
Example two
The second embodiment of the invention provides a data processing method based on cache, and the second embodiment of the invention optimizes the data processing method based on the first embodiment. Further, the cache-based data processing method further includes: when detecting that the data associated with any keyword stored in the buffer exceeds a set storage period, deleting the data associated with the keyword stored in the buffer; or deleting any data stored in the database when the data is detected to be deleted and the data is stored in the buffer.
Further, before deleting the data associated with the keyword stored in the buffer when it is detected that the data associated with any keyword stored in the buffer exceeds a set storage period, the method further includes: and detecting whether the storage time length of the data related to each key word stored in the buffer exceeds the storage time limit of the data related to each key word at regular time. Preferably, the periodically detecting whether the storage time length of the data associated with each keyword stored in the buffer exceeds the storage time limit of the data associated with each keyword includes: detecting whether the storage time length of the data associated with each keyword stored in the buffer exceeds the storage time limit of the data associated with each keyword before the matched data is acquired from the buffer; and/or detecting whether the storage time length of the data related to each key stored in the buffer exceeds the storage time limit of the data related to each key at fixed time intervals.
Correspondingly, fig. 2 shows a cache-based data processing method according to an embodiment of the present invention, and as shown in fig. 2, the method includes:
s210, determining whether data matching the data processing request exists in the buffer according to the data processing request received from the client, if so, executing step S220, and if not, executing step S250.
S220, detecting whether the storage time length of the data associated with each keyword stored in the buffer exceeds the storage time limit of the data associated with each keyword, if not, executing step S230, and if so, executing step S240.
The storage period of each data in the buffer can be set by the user according to the requirement, and the default data storage period of the server can also be used. For example, the storage period of the data may be set to 15 days.
S230, obtaining the matched data from the buffer, and skipping to execute operation S260.
S240, deleting the data related to the keyword stored in the buffer, and continuing to execute S250.
Preferably, a data delete function delete (stringkey) for deleting data stored in the buffer may be defined in the class MyCache.
S250, acquiring data matched with the data processing request from a preset database, sending the data acquired from the database to the buffer to enable the buffer to store the received data, and continuing to execute S260.
And S260, sending the acquired matched data to the client.
For example, the execution process of the cache-based data processing method provided by the embodiment of the present invention may be: a2, calling an isoexitkey function and a get function mapped by a datamap according to a key value contained in a data processing request received from a client to judge whether requested data exists in a buffer, if the value returned by the get function of the datamap is not empty, indicating that the key value exists, then judging whether the key value has expired, and if the key value has not expired, returning a true value by the isoexitkey function; if the key value is expired, the key value is invalid, a delete function of the dataMap mapping is called to delete the content corresponding to the key value in the dataMap mapping, a delete function of the dataMap mapping is called to delete the data, and the isExitKey function returns a false value; if the value returned by the get function of the dateMap is null, it indicates that the key value does not exist, and the isExitKey function returns a false value. b2, if the ISExitKey function return value is 'true', acquiring the requested data from the buffer; and if the return value of the isExitKey function is false, acquiring the requested data from the database, and calling the put function to store the requested data into the buffer. c2, sending the requested data to the corresponding client and finishing the operation.
Further, the method provided by the embodiment of the present invention further includes: and detecting whether the storage time length of the data related to each key stored in the buffer exceeds the storage time limit of the data related to each key at fixed intervals, and deleting the data content exceeding the storage time limit and the key value and the storage time limit related to the data from the class dataMap and the class dataMap if the data exceeding the storage time limit is detected. The time interval for detecting whether the data stored in the buffer exceeds the storage period is arbitrary, and may be set to 1 hour, 2 hours, 12 hours, 1 day, two days, or the like, which is not limited herein. For example, the interval time may be set to 1 day, that is, whether the data in the buffer exceeds the storage period is detected at a fixed time of each day. Preferably, the detection may be performed at a time when the server is relatively idle every day so as not to affect the response speed of the client calling data, for example, the time when the server performs the detection may be set to 1:00 a morning every day.
Further, the method provided by the embodiment of the present invention further includes: and when any data stored in the database is detected to be deleted and the data is stored in the buffer, deleting the data stored in the buffer. That is, the user may delete data in the database through the client, and when the server detects that a certain data in the database is deleted, the server calls the isenistkey to determine whether the data exists in the buffer, and if so, calls the delete function of the dataMap and the dateMap to delete the content corresponding to the data in the two maps, so as to keep the buffer and the database synchronized.
The data processing method based on the cache provided by the embodiment of the invention judges whether the requested data exists in the cache or not according to the data processing request received from the client, if not, the requested data is obtained from the database and stored in the cache; if the data is existed, further judging whether the requested data in the buffer exceeds the storage time limit, if not, calling the requested data from the buffer; and if the requested data in the buffer exceeds the storage period, deleting the data in the buffer, acquiring the requested data from the database and storing the requested data in the buffer again. In addition, the method also comprises deleting the data in the database according to the requirement of the user, and if the data exists in the buffer, deleting the data in the buffer at the same time; and/or, detecting data in the buffer at fixed time intervals and deleting the detected data exceeding a predetermined period. By adopting the technical scheme, the embodiment of the invention regularly detects whether each data stored in the buffer exceeds the storage period and deletes the data exceeding the storage period, if the data which does not exist in the database exists in the buffer, the data in the buffer is deleted, so that the situation that new data cannot be stored in the buffer due to the fact that a large amount of expired data is stored in the buffer can be avoided, the data stored in the buffer is ensured to be used recently, and the practicability of the data stored in the buffer is improved. In addition, if the requested data exists in the cache, the requested data is directly called from the cache, so that the time required by the server for calling the data can be effectively saved, the response speed of the client is improved, the waiting time of a user is reduced, and the use experience of the user is improved.
On the basis of the above embodiment, the cache-based data processing method further includes: acquiring a modification request sent by the client, wherein the modification request comprises data to be modified and corresponding modification result data; replacing the data to be modified stored in the database with the modification result data; and when the data to be modified is stored in the buffer, replacing the data to be modified stored in the buffer with the modification result data.
Wherein, the modified data refers to data before modification by the client; the modification result data refers to data after the modification of the client is completed. For example, the process of modifying the data in the database by the client may be: defining a data update function update (Stringkey, ObjectObject) in the class MyCache; the client modifies the data and sends the data to be modified and the modified result data to the server; the server replaces the data to be modified stored in the database with modified result data; the server judges whether the data to be modified exists in the buffer, if so, the update function is called to replace the data to be modified in the buffer with the modified result data, and if not, the put function is called to store the modified result data in the buffer. The part can be used for modifying the data in the database according to the needs of the user, and further modifying the data in the buffer, so that the speed of calling the data next time is improved, and the user experience is improved.
On the basis of the above embodiment, the cache-based data processing method further includes: acquiring a data storage request sent by a client; allocating a unique key word of the buffer for the data to be stored contained in the data storage request; and storing the data to be stored in the buffer according to the allocated unique key words. Accordingly, as shown in fig. 3, the cache-based data storage process may include:
s310, the client sends a data storage request to a corresponding server.
Specifically, the server stores the data to be stored received from the client into the database.
S320, the server allocates the unique key words for the data to be stored as the unique key words to be stored.
S330, the server judges whether the buffer has the unique key word to be stored, if not, S360 is executed; if so, then S340 is performed.
S340, the server confirms whether the data of the unique key word to be stored is used in the memory to be covered or not to the user through the client, and if the data is used, S360 is executed; if not, go to step S350.
And S350, the server allocates other keywords for the data to be stored again to serve as the current unique keyword to be stored, and the step returns to execute S330.
Specifically, the server determines whether the buffer has the current unique key to be stored again, and loops through steps S330, S340, and S350 until the buffer does not have the current unique key to be stored.
And S360, the server stores the data to be stored into the buffer by using the allocated unique key word to be stored.
The scheme can be used for storing new data into the database according to the user requirements and further storing the data into the cache, so that the speed of calling the data next time is increased, and the user experience is improved.
EXAMPLE III
A third embodiment of the present invention provides a data processing apparatus based on a cache, where the apparatus may be used to execute a data processing method based on a cache provided in any embodiment of the present invention. Fig. 4 is a block diagram illustrating a structure of a data processing apparatus based on a cache according to an embodiment of the present invention, where as shown in fig. 4, the apparatus includes:
a data determining module 410, configured to determine whether data matching the data processing request exists in the buffer according to the data processing request received from the client;
a data obtaining module 420, configured to, if there is data matching the data processing request in the cache, obtain the matching data from the cache; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data;
and a data sending module 430, configured to send the obtained matched data to the client.
Further, the data processing apparatus based on cache provided in the embodiment of the present invention further includes: a data deletion module, the data deletion module specifically configured to: when detecting that the data associated with any keyword stored in the buffer exceeds a set storage period, deleting the data associated with the keyword stored in the buffer; or deleting any data stored in the database when the data is detected to be deleted and the data is stored in the buffer.
Further, the data processing apparatus based on cache provided in the embodiment of the present invention further includes: and the data scanning module is used for detecting whether the storage time length of the data associated with each keyword stored in the buffer exceeds the storage time limit of the data associated with each keyword at regular time before deleting the data associated with the keyword stored in the buffer when detecting that the data associated with any keyword stored in the buffer exceeds the set storage time limit.
Further, the data processing apparatus based on cache provided in the embodiment of the present invention further includes:
a modification request acquisition module, configured to acquire a modification request sent by the client; the modification request comprises data to be modified and corresponding modification result data;
the first modification module is used for modifying the data to be modified stored in the database into the modification result data;
and the second modification module is used for modifying the data to be modified stored in the buffer into the modification result data when the data to be modified is stored in the buffer.
Further, the data processing apparatus based on cache provided in the embodiment of the present invention further includes:
the storage request acquisition module is used for acquiring a data storage request sent by a client;
the key word distribution module is used for distributing the unique key word of the buffer for the data to be stored contained in the data storage request;
and the data storage module is used for storing the data to be stored in the buffer according to the allocated unique key words.
The data processing device based on the cache provided by the embodiment of the invention can be used for executing the data processing method based on the cache provided by any embodiment of the invention, and has functional modules corresponding to the data processing method and beneficial effects. For details of the technique not described in detail in this embodiment, reference may be made to the cache-based data processing method provided in any embodiment of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (10)

1. A data processing method based on cache is characterized by comprising the following steps:
judging whether data matched with the data processing request exists in a buffer according to the data processing request received from the client;
if the data matched with the data processing request exists in the buffer, acquiring the matched data from the buffer; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data;
and sending the acquired matched data to the client.
2. The method of claim 1, further comprising:
when detecting that the data associated with any keyword stored in the buffer exceeds a set storage period, deleting the data associated with the keyword stored in the buffer; or,
and when any data stored in the database is detected to be deleted and the data is stored in the buffer, deleting the data stored in the buffer.
3. The method according to claim 2, wherein before deleting the data associated with the keyword stored in the buffer when detecting that the data associated with any keyword stored in the buffer exceeds a set storage period, the method further comprises:
and detecting whether the storage time length of the data related to each key word stored in the buffer exceeds the storage time limit of the data related to each key word at regular time.
4. The method of claim 1, further comprising:
acquiring a modification request sent by the client, wherein the modification request comprises data to be modified and corresponding modification result data;
replacing the data to be modified stored in the database with the modification result data;
and when the data to be modified is stored in the buffer, replacing the data to be modified stored in the buffer with the modification result data.
5. The method of claim 1, further comprising:
acquiring a data storage request sent by a client;
allocating a unique key word of the buffer for the data to be stored contained in the data storage request;
and storing the data to be stored in the buffer according to the allocated unique key words.
6. A cache-based data processing apparatus, comprising:
the data judgment module is used for judging whether data matched with the data processing request exists in the buffer according to the data processing request received from the client;
the data acquisition module is used for acquiring matched data from the buffer if the data matched with the data processing request exists in the buffer; otherwise, acquiring data matched with the data processing request from a preset database, and sending the data acquired from the database to the buffer memory to enable the buffer memory to store the received data;
and the data sending module is used for sending the acquired matched data to the client.
7. The apparatus of claim 6, further comprising: a data deletion module, the data deletion module specifically configured to:
when detecting that the data associated with any keyword stored in the buffer exceeds a set storage period, deleting the data associated with the keyword stored in the buffer; or,
and when any data stored in the database is detected to be deleted and the data is stored in the buffer, deleting the data stored in the buffer.
8. The apparatus of claim 7, further comprising:
and the data scanning module is used for detecting whether the storage time length of the data associated with each keyword stored in the buffer exceeds the storage time limit of the data associated with each keyword at regular time before deleting the data associated with the keyword stored in the buffer when detecting that the data associated with any keyword stored in the buffer exceeds the set storage time limit.
9. The apparatus of claim 6, further comprising:
a modification request acquisition module, configured to acquire a modification request sent by the client; the modification request comprises data to be modified and corresponding modification result data;
the first modification module is used for modifying the data to be modified stored in the database into the modification result data;
and the second modification module is used for modifying the data to be modified stored in the buffer into the modification result data when the data to be modified is stored in the buffer.
10. The apparatus of claim 6, further comprising:
the storage request acquisition module is used for acquiring a data storage request sent by a client;
the key word distribution module is used for distributing the unique key word of the buffer for the data to be stored contained in the data storage request;
and the data storage module is used for storing the data to be stored in the buffer according to the allocated unique key words.
CN201510799849.4A 2015-11-19 2015-11-19 Cache-based data processing method and device Pending CN105468707A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510799849.4A CN105468707A (en) 2015-11-19 2015-11-19 Cache-based data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510799849.4A CN105468707A (en) 2015-11-19 2015-11-19 Cache-based data processing method and device

Publications (1)

Publication Number Publication Date
CN105468707A true CN105468707A (en) 2016-04-06

Family

ID=55606408

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510799849.4A Pending CN105468707A (en) 2015-11-19 2015-11-19 Cache-based data processing method and device

Country Status (1)

Country Link
CN (1) CN105468707A (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106210117A (en) * 2016-08-01 2016-12-07 浪潮软件股份有限公司 High-performance service architecture realized through cloud cache
CN107273216A (en) * 2016-04-08 2017-10-20 阿里巴巴集团控股有限公司 A kind of processing method of request of data, apparatus and system
CN107786595A (en) * 2016-08-26 2018-03-09 阿里巴巴集团控股有限公司 The processing method of keyword, apparatus and system in distributed memory system
CN108153825A (en) * 2017-12-07 2018-06-12 石化盈科信息技术有限责任公司 Data access method and device
CN108153812A (en) * 2017-11-24 2018-06-12 广州高清视信数码科技股份有限公司 Method, apparatus, computer equipment and the storage medium of data communication
CN108428182A (en) * 2017-06-25 2018-08-21 平安科技(深圳)有限公司 Development platform device, the method and computer readable storage medium for obtaining number of policy
CN108920098A (en) * 2018-06-20 2018-11-30 郑州云海信息技术有限公司 A kind of storage management system collects method, system and the equipment of information
CN109885593A (en) * 2019-02-21 2019-06-14 北京字节跳动网络技术有限公司 Method and apparatus for handling information
CN110535948A (en) * 2019-08-30 2019-12-03 北京东软望海科技有限公司 Acquisition methods, device, electronic equipment and the computer readable storage medium of data
CN110837480A (en) * 2019-11-07 2020-02-25 北京沃东天骏信息技术有限公司 Processing method and device of cache data, computer storage medium and electronic equipment
CN114584576A (en) * 2022-03-04 2022-06-03 拉扎斯网络科技(上海)有限公司 Data storage method, device, equipment, storage medium and computer program product

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102682037A (en) * 2011-03-18 2012-09-19 阿里巴巴集团控股有限公司 Data acquisition method, system and device
CN103177005A (en) * 2011-12-21 2013-06-26 深圳市腾讯计算机系统有限公司 Processing method and system of data access
CN103401950A (en) * 2013-08-21 2013-11-20 网宿科技股份有限公司 Cache asynchronism refreshment method, as well as method and system for processing requests by cache server
CN103631972A (en) * 2013-12-23 2014-03-12 济南大学 Column access perception data caching method and column access perception data caching system
CN104123238A (en) * 2014-06-30 2014-10-29 海视云(北京)科技有限公司 Data storage method and device
CN104268286A (en) * 2014-10-21 2015-01-07 北京国双科技有限公司 Method for querying hot data
CN104391862A (en) * 2014-10-23 2015-03-04 北京锐安科技有限公司 Method and device for updating cache data
CN104657401A (en) * 2014-10-21 2015-05-27 北京齐尔布莱特科技有限公司 Web cache updating method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102682037A (en) * 2011-03-18 2012-09-19 阿里巴巴集团控股有限公司 Data acquisition method, system and device
CN103177005A (en) * 2011-12-21 2013-06-26 深圳市腾讯计算机系统有限公司 Processing method and system of data access
CN103401950A (en) * 2013-08-21 2013-11-20 网宿科技股份有限公司 Cache asynchronism refreshment method, as well as method and system for processing requests by cache server
CN103631972A (en) * 2013-12-23 2014-03-12 济南大学 Column access perception data caching method and column access perception data caching system
CN104123238A (en) * 2014-06-30 2014-10-29 海视云(北京)科技有限公司 Data storage method and device
CN104268286A (en) * 2014-10-21 2015-01-07 北京国双科技有限公司 Method for querying hot data
CN104657401A (en) * 2014-10-21 2015-05-27 北京齐尔布莱特科技有限公司 Web cache updating method
CN104391862A (en) * 2014-10-23 2015-03-04 北京锐安科技有限公司 Method and device for updating cache data

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107273216B (en) * 2016-04-08 2020-10-13 阿里巴巴集团控股有限公司 Data request processing method, device and system
CN107273216A (en) * 2016-04-08 2017-10-20 阿里巴巴集团控股有限公司 A kind of processing method of request of data, apparatus and system
CN106210117A (en) * 2016-08-01 2016-12-07 浪潮软件股份有限公司 High-performance service architecture realized through cloud cache
CN107786595A (en) * 2016-08-26 2018-03-09 阿里巴巴集团控股有限公司 The processing method of keyword, apparatus and system in distributed memory system
CN108428182A (en) * 2017-06-25 2018-08-21 平安科技(深圳)有限公司 Development platform device, the method and computer readable storage medium for obtaining number of policy
CN108428182B (en) * 2017-06-25 2021-08-24 平安科技(深圳)有限公司 Development platform device, method for acquiring policy number, and computer-readable storage medium
CN108153812A (en) * 2017-11-24 2018-06-12 广州高清视信数码科技股份有限公司 Method, apparatus, computer equipment and the storage medium of data communication
CN108153825A (en) * 2017-12-07 2018-06-12 石化盈科信息技术有限责任公司 Data access method and device
CN108920098A (en) * 2018-06-20 2018-11-30 郑州云海信息技术有限公司 A kind of storage management system collects method, system and the equipment of information
CN109885593A (en) * 2019-02-21 2019-06-14 北京字节跳动网络技术有限公司 Method and apparatus for handling information
CN110535948A (en) * 2019-08-30 2019-12-03 北京东软望海科技有限公司 Acquisition methods, device, electronic equipment and the computer readable storage medium of data
CN110837480A (en) * 2019-11-07 2020-02-25 北京沃东天骏信息技术有限公司 Processing method and device of cache data, computer storage medium and electronic equipment
CN114584576A (en) * 2022-03-04 2022-06-03 拉扎斯网络科技(上海)有限公司 Data storage method, device, equipment, storage medium and computer program product
CN114584576B (en) * 2022-03-04 2024-07-19 拉扎斯网络科技(上海)有限公司 Data storage method, apparatus, device, storage medium and computer program product

Similar Documents

Publication Publication Date Title
CN105468707A (en) Cache-based data processing method and device
US10489476B2 (en) Methods and devices for preloading webpages
US10250526B2 (en) Method and apparatus for increasing subresource loading speed
TWI614703B (en) Information recommendation method and information recommendation device
US9009103B2 (en) Fingerprint-based, intelligent, content pre-fetching
JP6169764B2 (en) Providing executable content to computing devices based on user actions
CN108429777B (en) Data updating method based on cache and server
WO2016107464A1 (en) Method and device for implementing card-type desktop
EP3049940B1 (en) Data caching policy in multiple tenant enterprise resource planning system
CN110677492B (en) Access request processing method and device, electronic equipment and storage medium
CN106302829A (en) A kind of information access method, device and server
CN108647240B (en) Method and device for counting access amount, electronic equipment and storage medium
CN105868234A (en) Update method and device of caching data
WO2022062184A1 (en) High-concurrency query method, intelligent terminal and storage medium
WO2019041670A1 (en) Method, device and system for reducing frequency of functional page requests, and storage medium
CN113630329A (en) Load balancing method and system based on user access amount and readable storage medium
US10242102B2 (en) Network crawling prioritization
CN110795395A (en) File deployment system and file deployment method
CN108021409B (en) APP service scenario restoration method and system
US20120259945A1 (en) System and method for dynamically modifying content based on user expectations
US20230388260A1 (en) Storage space optimization for emails
CN109101310B (en) Page refreshing method and device
CN109995855B (en) Data acquisition method, device and terminal
CN110807040B (en) Method, device, equipment and storage medium for managing data
CN108549584B (en) Method and device for degrading gray level of server side

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20160406