Cache read-write method and terminal

A caching, reading and writing technology, applied in the field of caching, can solve problems such as memory data reading and writing conflicts, thread freezes, program crashes, etc., and achieve the effect of separating reading and writing and relieving the pressure of reading and writing

Active Publication Date: 2019-08-02
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF10 Cites 1 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

But there is a new problem at this time, that is, when the data needs to be modified under high concurrency, it will cause frequent read and write conflicts in the memory data
[0003] At present, in order to avoid data inaccuracy caused by read-write conflicts, lock processing is usually performed when writing data, but this method will affect the read operation of data. Since it is executed synchronously and serially, when writing After the data is locked, the process of reading the data will also wait. The data can only be read after waiting for the completion of the data writing. In the case of high concurrency, it will directly lead to thread freezes, program crashes or Serious consequences such as server downtime

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
  • Cache read-write method and terminal
  • Cache read-write method and terminal
  • Cache read-write method and terminal

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0065] Please refer to figure 1 and Figure 3-4 , a method for caching reads and writes, including steps:

[0066] S1. Set up read-only cache, read-write cache and normal cache;

[0067] Specifically, the data types stored in the local memory are divided into three types: read-only cache, read-write cache, and common cache, and the common cache is the real data storage cache;

[0068] The read-only cache, read-write cache and common cache are all stored in the memory in the data structure mode of MAP;

[0069] S21. In the read scenario, if no corresponding data is queried in the read-only cache, query the read-write cache; if no corresponding data is queried in the read-write cache, query the normal cache, and updating the read-only cache and the read-write cache respectively with the data queried by the common cache;

[0070] Specifically, the client requests the interface API to obtain relevant data information, that is, sends a data request;

[0071] S211, the interfac...

Embodiment 2

[0084] The difference between this embodiment and embodiment one is:

[0085] The regular polling of the read-write cache in the step S3 is specifically:

[0086] The read-write cache is periodically polled by an independent asynchronous thread.

[0087] Specifically, for example, by polling the read-write cache at intervals of 30 seconds by an independent asynchronous thread, the read-write cache can be monitored without affecting original business logic and occupying resources.

Embodiment 3

[0089] Please refer to figure 2 , a terminal 1 for buffering read and write, including a memory 2, a processor 3, and a computer program stored on the memory 2 and operable on the processor 3, when the processor 3 executes the computer program, it implements Steps in Example 1.

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 cache read-write method and a terminal. A read-write cache is arranged between a read-only cache and a common cache; in a reading scene, the read-write cache is inquired whenthe read-only cache does not inquire the corresponding data, the common cache is inquired when the read-write cache does not inquire the corresponding data, and the read-only cache and the read-writecache are respectively updated according to the data inquired in the common cache; and in a writing scene, the read-write cache is emptied after the common cache is updated successfully. The read-write cache is used as middleware; after the common cache is updated successfully, the read-write cache is firstly emptied, the read-write pressure under high concurrency can be effectively relieved whenthe read-write operation occurs at the same time, the method is different from the prior art that read-write waiting is caused due to the fact that data read-write is locked, read-write separation ofcache data can be achieved, and cache data read-write under a high concurrency scene is supported.

Description

technical field [0001] The invention relates to the technical field of caching, in particular to a method for caching reading and writing and a terminal. Background technique [0002] Usually, cache servers such as redis or memcache are used as the cache layer in the system to provide cache services in the form of clusters or single nodes. In most cases, the system also implements the function of data storage through local cache. When using local memory as a cache, fast reading and writing of data under high concurrency conditions can be achieved. But there is a new problem at this time, that is, when the data needs to be modified under high concurrency, it will cause frequent read and write conflicts in the memory data. [0003] At present, in order to avoid data inaccuracy caused by read-write conflicts, lock processing is usually performed when writing data, but this method will affect the read operation of data. Since it is executed synchronously and serially, when wri...

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): G06F12/0895G06F12/0891
CPCG06F12/0891G06F12/0895G06F2212/1032
Inventor 刘德建林伟郭玉湖
Owner FUJIAN TIANQUAN EDUCATION TECH 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