Data caching method and apparatus

A technology for caching data and data, which is applied in the computer field, can solve problems such as decreased access speed, lower user experience, and affect access data speed, so as to achieve the effect of enhancing experience and ensuring access speed

Active Publication Date: 2017-02-15
BEIJING QIHOO TECH CO LTD
View PDF6 Cites 5 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] However, the data in the cache has an expiration time. Once the expiration time is exceeded, the data will be automatically deleted from the cache. When the deleted data is accessed again, the data needs to be read from the database again. Therefore, for some hot data Said that its access speed will drop, which will seriously affect the speed of accessing data and reduce user experience

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Data caching method and apparatus
  • Data caching method and apparatus
  • Data caching method and apparatus

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0038] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0039] figure 1 A schematic flowchart of a method for caching data provided according to an embodiment of the present invention is shown. Such as figure 1 As shown, the method includes:

[0040] Step S110, for a piece of data, set two key-value pairs corresponding to the data in the cache; where the first key-value pair is used to store the data itself, and its valid time in the cache is set as the first preset time; use the sec...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a data caching method and apparatus. The method comprises the steps of setting two key-value pairs corresponding to data in a cache for a piece of data; storing the data by the first key-value pair, and setting effective time of the data in the cache to be a first preset time; marking pre-failure time of the data by the second key-value pair, and setting the effective time of the data in the cache to be a second preset time, wherein the second preset time is shorter than the first preset time; when a data request is received, performing a search in the cache according to the data request; and if only the first key-value pair is found in the cache, returning a value in the first key-value pair to a requester, reading data of the request from a database again to update the value in the corresponding first key-value pair in the cache, and resetting the corresponding second key-value pair and the corresponding first preset time and second preset time. According to the scheme, the data in the cache can be ensured not to lose efficiency, and the data access speed can be ensured.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for caching data. Background technique [0002] With the vigorous development of the Internet, massive amounts of data need to be stored in many application scenarios. When reading data from the database, because the database and access volume are too large, it will cause a delay in accessing data and affect the speed of reading data. Usually, hot data with high access frequency is put into the cache, and when a request for accessing hot data is received, it is directly read from the cache, which greatly increases the reading speed. [0003] However, the data in the cache has an expiration time. Once the expiration time is exceeded, the data will be automatically deleted from the cache. When the deleted data is accessed again, the data needs to be read from the database again. Therefore, for some hot data Said that its access speed will drop, which will se...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30
CPCG06F16/24552
Inventor 李勇智
Owner BEIJING QIHOO TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products