CN113641711A - Data caching processing method, device and medium for SAAS tenant - Google Patents

Data caching processing method, device and medium for SAAS tenant Download PDF

Info

Publication number
CN113641711A
CN113641711A CN202110940240.XA CN202110940240A CN113641711A CN 113641711 A CN113641711 A CN 113641711A CN 202110940240 A CN202110940240 A CN 202110940240A CN 113641711 A CN113641711 A CN 113641711A
Authority
CN
China
Prior art keywords
data
key
cache region
cache
service data
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.)
Granted
Application number
CN202110940240.XA
Other languages
Chinese (zh)
Other versions
CN113641711B (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.)
Tianjin Zhuoshengyun Technology Co ltd
Original Assignee
Tianjin Zhuoshengyun 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 Tianjin Zhuoshengyun Technology Co ltd filed Critical Tianjin Zhuoshengyun Technology Co ltd
Priority to CN202110940240.XA priority Critical patent/CN113641711B/en
Priority claimed from CN202110940240.XA external-priority patent/CN113641711B/en
Publication of CN113641711A publication Critical patent/CN113641711A/en
Application granted granted Critical
Publication of CN113641711B publication Critical patent/CN113641711B/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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2291User-Defined Types; Storage management thereof
    • 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/24553Query execution of query operations

Landscapes

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

Abstract

The application discloses a data caching processing method, a device and a medium for SAAS tenants, which comprise the following steps: generating key data according to the access request; wherein the access request comprises service data requested to be accessed; searching the cache state of the key data in the first cache region; when the key data are not cached in the first cache region, storing the key data into the first cache region; searching the cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data; and when the service data identification is not cached in the second cache region, storing the service data identification into the second cache region. The problem of low performance when multi-tenant service data caching is carried out can be solved.

Description

Data caching processing method, device and medium for SAAS tenant
Technical Field
The present application relates to the field of computer application technologies, and in particular, to a data caching method, apparatus, and medium for SAAS tenants.
Background
In the development of application systems, databases are often a basic key service. But the request for the database is also a heavy burden operation and often becomes a bottleneck in system performance. In order to reduce the access requests of the database, some large-scale Web applications use internal storage databases such as redis and memcache as cache layers of actual databases to reduce the access to background databases.
In the SaaS application system, a plurality of tenants are distinguished, and the inside of each tenant is divided into a plurality of users with different authority types. The users in the same tenant have authority control, and different tenants generally cannot access each other. Therefore, how to control the use of the cache, that is, to avoid the failure of the authority control, and to use the cache data as well as possible is a relatively complicated problem.
For cache data, a Key and a corresponding Value are generally stored in a memory. The corresponding adding, deleting, modifying and checking operations have different processing methods for the cache data. Two types can be generally distinguished:
one type is caching a single record, namely one Key corresponds to one record. For the cache operation of such records, for the added record, the cache record is newly added; if the cache has no record for the query operation, adding cache data, and if the cache has the record, only using the cache data; for the modification operation, the cache record is updated; for a deleted record, the record is also deleted in the cache. Due to the caching of the single record, it is mature and will not be discussed here.
The other type is caching set data, that is, one Key corresponds to a plurality of records, for example, a user list under a certain tenant is obtained, or information of a certain type of commodity is cached by a Key to set a plurality of records. Generally, the acquisition of the aggregate data in such request operations is a query operation, and the query result is stored in a cache, so that the query performance can be obviously improved. In addition, in order to prevent the data size of one request from being too large, the operation of paging is usually required. However, adding, modifying, and deleting a record in the set all result in changes of the set data and cache invalidation. Especially for paging operation of a set, a change of one record may cause cache data of all pages to be invalid, but if only the set cache is simply cleared, the cache effect is not good.
Therefore, for the above-mentioned aggregate caching, how to improve the effect of the aggregate caching, and at the same time, how to guarantee the authority control of multiple tenants is a difficult problem in the current caching process.
Disclosure of Invention
The present application is proposed to solve the above-mentioned technical problems. Embodiments of the present application provide a data caching method, apparatus, and medium for SAAS tenants, which can solve the problem of low performance when caching multi-tenant service data.
According to an aspect of the present application, a data caching processing method for an SAAS tenant is provided, including: generating key data according to the access request; wherein the access request comprises service data requested to be accessed; searching the cache state of the key data in a first cache region; when the key data are not cached in the first cache region, storing the key data into the first cache region; searching the cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data; and when the service data identification is not cached in the second cache region, storing the service data identification into the second cache region.
In an embodiment, the generating key data according to the access request includes: determining the type of the service data and tenant information according to the access request; determining a corresponding storage space in the first cache region according to the type of the service data; and generating key data according to the access request, the corresponding storage space in the first cache region and the tenant information.
In an embodiment, when the critical data is not cached in the first cache region, the storing the critical data in the first cache region includes: when the key data are not cached in the first cache region, inquiring in a tenant service region; the query value corresponding to each key data can be obtained through the key data in the tenant service area; storing the key data and the query value of the key data in the first cache region; wherein the key data and the query value form a key-value pair in the first cache region.
In an embodiment, before the searching for the cache state of the service data identifier in the second cache region, the data cache processing method for the SAAS tenant further includes: and analyzing the query value of the key data to obtain a service data identifier corresponding to the query value.
In an embodiment, when the service data identifier is not cached in the second cache region, storing the service data identifier in the second cache region includes: when the service data identifier is not cached in the second cache region, converting key data corresponding to the service data identifier into a key value list; the service data identifier and the key value list form a key value pair in the second cache region; and storing the service data identification and the key value list into the second cache region.
In an embodiment, after searching for the cache state of the service data identifier in the second cache region, the data cache processing method for the SAAS tenant further includes: when the service data identification is cached in the second cache region, inquiring the existence state of the key data in a key value list corresponding to the service data identification; a plurality of service data identifications and a plurality of key value lists respectively corresponding to the service data identifications are cached in the second cache region in advance, and the key value lists comprise a plurality of key data; when the presence status indicates that the key data is not included in the key value list, adding the key data to the key value list; and storing the key value list after the key data is added and the service data identifier into the second cache region.
In an embodiment, the data caching processing method for SAAS tenant further includes: determining a service data identifier to be modified according to the modification instruction; searching a key value list corresponding to the service data identification to be modified in the second cache region; deleting the key value list in the second cache region when the key value list corresponding to the service data identifier to be modified exists in the second cache region; and deleting the corresponding key data in the key value list in the first cache region.
In an embodiment, the data caching processing method for SAAS tenant further includes: determining key data to be deleted and a service data identifier to be deleted according to a deletion instruction; deleting the key data to be deleted and the query value corresponding to the key data to be deleted in the first cache region; and deleting the service data identification to be deleted and a key value list corresponding to the service data identification to be deleted in the second cache region.
According to another aspect of the present application, there is provided a data cache processing apparatus for SAAS tenant, including: the generating module is used for generating key data according to the access request; wherein the access request comprises service data requested to be accessed; the first searching module is used for searching the cache state of the key data in the first cache region; the first storage module is used for storing the key data into the first cache region when the key data is not cached in the first cache region; the second searching module is used for searching the cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data; and the second storage module is used for storing the service data identifier into the second cache region when the service data identifier is not cached in the second cache region.
According to another aspect of the present application, a computer-readable storage medium is provided, where the storage medium stores a computer program for executing the data caching processing method for SAAS tenant according to any of the above embodiments.
The data caching processing method, the data caching processing device and the data caching processing medium for the SAAS tenant adopt two modules to respectively cache business data, the second caching area can record an aggregate caching range influenced by key identification data of a single business, the influence on aggregate caching can be reduced, specific key data can be located in the second caching area through the business data identification, the cache data in the first caching area and the second caching area can be changed only by subsequently updating the key data, the too large caching failure range is avoided, the performance of a system can be improved, and the problem of low performance during caching of multi-tenant business data is solved.
Drawings
The above and other objects, features and advantages of the present application will become more apparent by describing in more detail embodiments of the present application with reference to the attached drawings. The accompanying drawings are included to provide a further understanding of the embodiments of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the principles of the application. In the drawings, like reference numbers generally represent like parts or steps.
Fig. 1 is a schematic structural diagram of a data cache processing system for SAAS tenants according to an exemplary embodiment of the present application.
Fig. 2 is a schematic flowchart of a data caching processing method for SAAS tenants according to an exemplary embodiment of the present application.
Fig. 3 is a flowchart illustrating a data caching processing method for SAAS tenants according to another exemplary embodiment of the present application.
Fig. 4 is a flowchart illustrating a data caching processing method for SAAS tenants according to another exemplary embodiment of the present application.
Fig. 5 is a flowchart illustrating a data caching processing method for SAAS tenants according to another exemplary embodiment of the present application.
Fig. 6 is a flowchart illustrating a data caching processing method for SAAS tenant according to another exemplary embodiment of the present application.
Fig. 7 is a flowchart illustrating a method for modifying cache data according to an exemplary embodiment of the present application.
Fig. 8 is a flowchart illustrating a method for deleting cached data according to an exemplary embodiment of the present application.
Fig. 9 is a flowchart illustrating a method for querying cache data according to an exemplary embodiment of the present application.
Fig. 10 is a flowchart illustrating a method for modifying cache data according to another exemplary embodiment of the present application.
Fig. 11 is a flowchart illustrating a method for adding or deleting cache data according to an exemplary embodiment of the present application.
Fig. 12 is a schematic structural diagram of an apparatus for processing cached data according to an exemplary embodiment of the present application.
Fig. 13 is a schematic structural diagram of an apparatus for processing cached data according to another exemplary embodiment of the present application.
Fig. 14 is a block diagram of an electronic device provided in an exemplary embodiment of the present application.
Detailed Description
Hereinafter, example embodiments according to the present application will be described in detail with reference to the accompanying drawings. It should be understood that the described embodiments are only some embodiments of the present application and not all embodiments of the present application, and that the present application is not limited by the example embodiments described herein.
Exemplary System
Fig. 1 is a schematic structural diagram of a data caching processing system for SAAS tenants according to an exemplary embodiment of the present application, and as shown in fig. 1, the present application may be applied to a data caching processing system 2 for SAAS tenants, where the data caching processing system 2 for SAAS tenants includes: an upper layer client 21, a tenant server 23, a first cache 24, a second cache 25 and a cache accessor 22; the upper layer client 21 is connected with the cache accessor 22, the cache accessor 22 is connected with the tenant server 23, the first cache 24 is connected with the cache accessor 22, and the second cache 25 is connected with the first cache 24.
The tenant server 23 is configured to store a plurality of pieces of tenant information, a plurality of pieces of service data corresponding to each piece of tenant information, a type of each piece of service data, and a service data identifier of each piece of service data; the tenant server 23 can also be used to perform actual business operations including adding business data, deleting business data, querying business data, and modifying business data.
The tenant server 23 is based on the Saas service model, with each tenant having an ID, here named SaasId. Under each tenant, there is related service data, such as user information data and commodity data, which are different service data. Each record of service data has its own ID, here named bizId.
The first buffer 24, the first buffer 24 includes a first buffer area, the first buffer area may be divided into a plurality of storage spaces, each storage space is used for buffering different types of service data, and the data buffered in the first buffer 24 includes key data and query values.
The first buffer 24 corresponds to a CacheName for each type of service data, and is used to store the buffer of the service type. The CacheName is equivalent to a cache space of service data, so that different sets of service data can be isolated from each other without influencing each other. Under the CacheName, the specific cache data is in a Key-Value form, that is, a Key-corresponding related data Value is cached. The Key value is the Key data, and the design format is generally as follows: Saasid-PageNo-ReqStr, here named reqKey, where Saasid is the tenant's information, such as the tenant ID, so that the ID prefixes of different tenants are different. PageNo page number, which is the page number in the specified request. ReqStr is a request parameter, which is a string converted from an input parameter of an operation. Here the number of records per page is a fixed default value.
And the second buffer 25, where the second buffer 25 is connected to the first buffer 24, and the second buffer 25 includes a second buffer area, and a plurality of storage spaces may be divided in the second buffer area, and each storage space is used for buffering different types of service data. And the storage space divided according to the service data type in the second cache region corresponds to the storage space divided according to the service data type in the first cache region. The data cached in the second cache 25 includes service data identification and key value list; the key value list includes a plurality of key data in the first buffer 24.
A second buffer 25, which is the second buffer in this application. Similarly, the same CacheName corresponds to each type of service data. Under the CacheName, the format of the Key value in the cache is as follows: Saasid-bizId, the corresponding Value is named KeyList here. The KeyList records that the bizId includes the data of the bizId record in the Value values specified by the reqkeys in the first buffer 24, that is, the KeyList Value here is a list of names of some reqkeys in the first buffer 24, and each reqKey Value in the list includes the record of the bizId in the corresponding Value in the first buffer 24.
And the cache accessor 22, the cache accessor 22 is connected with the tenant server 23 and the first cache 24, and the cache accessor 22 is used for obtaining an instruction and calling the tenant server 23 or the first cache 24 according to the instruction. The cache accessor 22 supports 4 types of request operations for each type of service data, and comprises the following steps: addition, deletion, and modification operations of single records, and query operations on collections. For example, adding a user, deleting a user, and modifying a user into a single record operation; for example, querying a list of all users, querying a category of users, or querying users created after a certain time point all belong to a collective query operation. In addition, there are specific query parameters, denoted ReqStr.
The cache accessor 22 is a request operation for performing add-delete-modify-check on the cache, where the query request is to return the aggregated data of multiple records at a time, and the add, delete, and modify operations are all operations that can only be performed on one bizId record at a time.
All the related operations are sent by a certain login user, and the login user belongs to a certain tenant, so that the tenant ID of the certain operation, namely the Saasid, can be obtained.
Exemplary method
Fig. 2 is a schematic flowchart of a data caching processing method for an SAAS tenant according to an exemplary embodiment of the present application, and as shown in fig. 2, the data caching processing method for the SAAS tenant includes:
step 110: generating the key data according to the access request.
Wherein the access request comprises the service data requested to be accessed.
And the upper-layer client sends a query request, and after receiving the access request, the cache accessor determines the value of the CacheName in the first cache according to the type of the service data, and then combines the value into a reqKey value according to the tenant ID, the query page number and the query parameter. For different query requests, even if the Saasid and the page number are the same, but the request parameters are different, the result Value is different, so the reqKey Value of different requests is also different.
Step 120: and searching the cache state of the key data in the first cache region.
And searching whether the key data are cached or not in the first cache region, if so, directly obtaining corresponding Value from the cache without specifically carrying out actual query operation, and taking the Value as a return result.
Step 130: and when the key data are not cached in the first cache region, storing the key data into the first cache region.
And if the key data are not cached in the first cache region, storing a key Value pair formed by the key data and the Value corresponding to the key data in the first cache region.
Step 140: and searching the cache state of the service data identifier in the second cache region.
The service data identifier is obtained by analyzing the query Value of the key data.
After the cache state of the key data in the first cache region is searched, whether the key data are stored by the corresponding service data identification is searched in the second cache region.
Step 150: and when the service data identification is not cached in the second cache region, storing the service data identification into the second cache region.
And when the key data are found in the second cache region without the storage form in the second cache region, resolving the query value of the key data into a service data identifier which can be identified by the second cache region, and storing the service data identifier and the relevant key data set into the second cache region.
According to the data caching processing method for the SAAS tenants, the two modules are adopted to respectively cache business data, the second caching area can record the set caching range influenced by a single business data identifier, the influence on set caching can be reduced, specific key data can be located in the second caching area through the business data identifier, the cached data in the first caching area and the second caching area can be changed only by subsequently updating the key data, the too large caching failure range is avoided, the system performance can be improved, and the problem of low performance during caching of multi-tenant business data is solved.
Fig. 3 is a flowchart illustrating a data caching processing method for SAAS tenant according to another exemplary embodiment of the present application, and as shown in fig. 3, the foregoing step 110 may include:
step 111: and determining the type of the service data and tenant information according to the access request.
The first cache region is provided with a plurality of cachenames (storage spaces), each storage space stores different types of service data, and different service data are isolated by using the cachenames (storage spaces), so that different service caches do not affect each other, for example, data of a cache user and data of a cache commodity do not affect each other. Each service data has tenant information as a prefix, and when an access request is received, the tenant information of the access request can be identified, for example, the SaasId is adopted as the prefix of each key data, so that the caches of different tenants can be guaranteed to be unaffected, and the tenants to which the cached data are directed can be distinguished through the prefixes of the key data.
Step 112: and determining a corresponding storage space in the first cache region according to the type of the service data.
According to the type of the service data, determining a CacheName (storage space) corresponding to the service data in a first cache region, and operating the service data in the corresponding CacheName (storage space) if the service data is to be operated.
Step 113: and generating key data according to the access request, the corresponding storage space in the first cache region and the tenant information.
Generating a request parameter according to an access request of a tenant, wherein the request parameter is a character string converted from an input parameter of a certain operation, the key data may further include a page number, and the design format of the key data may be: the method comprises the steps of Saasid-page number-request parameter, key data can be named reqKey, Saasid is tenant information and can be regarded as ID of a tenant, ID prefixes of different tenants are different, page numbers are page numbers in an access request, record data contained in each page is a fixed default value, namely business data contained in each page is recorded as a fixed default value, and a corresponding storage space can be inquired through the page numbers. Therefore, the key data can be generated according to the access request, the corresponding storage space in the first cache region and the tenant information.
Fig. 4 is a flowchart illustrating a data caching processing method for SAAS tenant according to another exemplary embodiment of the present application, and as shown in fig. 4, the foregoing step 130 may include:
step 131: and when the key data are not cached in the first cache region, inquiring in the tenant service region.
The query value corresponding to each key data can be obtained through the key data in the tenant service area.
The tenant business area generally is a specific database operation, and a query value corresponding to each key data can be obtained through the key data in the tenant business area.
If the reqKey (key data) does not exist in the first cache region, a specific query operation needs to be performed in the tenant service region through the tenant service server to obtain a query result. For example, entering reqKey (key data) in a tenant business region may obtain Value (query Value).
Step 132: storing the key data and the query value of the key data in a first cache region.
Wherein the key data and the query value form a key-value pair in the first cache region.
The first cache region stores the key data and the Value (query Value) key-Value pair queried by the key data, and returns the Value (query Value) to the cache accessor.
In an embodiment, before the step 140, the data caching processing method for the SAAS tenant may include: and analyzing the query value of the key data to obtain a service data identifier corresponding to the query value.
The first buffer can call the second buffer and upload the reqKey (key data) and Value (query Value), multiple pieces of key data and multiple corresponding query values can be queried in the first buffer, the second buffer analyzes the query Value set uploaded in the first buffer to obtain the service data identifier of each single record, namely the bizId, and the second buffer traverses each bizId (service data identifier).
Fig. 5 is a flowchart illustrating a data caching processing method for SAAS tenant according to another exemplary embodiment of the present application, and as shown in fig. 5, the step 150 may include:
step 151: and when the service data identifier is not cached in the second cache region, converting the key data corresponding to the service data identifier into a key value list.
The service data identifier and the key value list form a key value pair in the second cache region.
The storage form of the key data in the second cache region is SaasId-bizId, that is, tenant information (tenant ID) -service data identifier, and the corresponding SaasId-bizId is searched in the second cache region through bizId (service data identifier), that is, bizId (service data identifier) of the corresponding tenant information is searched. If the SaasId-bizId corresponding to the bizId does not exist in the second cache region, the reqKey (Key data) is converted into Keylist, and in the Key-Value Key Value pair of the second cache region, the SaasId-bizId is used as the Key and the Keylist is used as the Value.
Step 152: and storing the service data identification and the key value list into a second cache region.
The second cache region holds the SaasId-bizId and Keylist key value pairs.
Fig. 6 is a schematic flowchart of a data caching processing method for SAAS tenant according to another exemplary embodiment of the present application, and as shown in fig. 6, after step 140, the data caching processing method for SAAS tenant may further include:
step 170: and when the business data identification is cached in the second cache region, inquiring the existence state of the key data in the key value list corresponding to the business data identification.
And the second cache region pre-caches a plurality of service data identifications and a key value list corresponding to the plurality of service data identifications respectively, wherein the key value list comprises a plurality of key data.
And when the Saasid-bizId exists in the second cache region, inquiring Keylist (key value list) corresponding to the existing Saasid-bizId, and if the Keylist (key value list) contains reqKey (key data), not changing the existing cache data.
Step 180: when the presence status indicates that the key data is not included in the key value list, the key data is added to the key value list.
If reqKey (key data) is not contained in keylists (key value lists), reqKey (key data) is added to the end of keylists (key value lists) in comma-separated form.
Step 190: storing the key value list and the service data identification after adding the key data into a second cache region.
And updating and saving the Saasid-bizId and a new Keylist (key value list) key value pair in the second cache region.
Fig. 7 is a flowchart illustrating a method for modifying a cache data according to another exemplary embodiment of the present application, where as shown in fig. 7, the method for modifying a cache data may include:
step 210: and determining the service data identification to be modified according to the modification instruction.
After the cache accessor obtains a modification instruction (one service data record is modified) of the upper layer client, firstly, the tenant server is called to modify the service data of the bizId (service data identification), and then, a modification result is returned. And can confirm CacheName (memory space) according to modifying the order, and send CacheName (memory space), Saasid (tenant ID), bizId (business data identification) and Value to the first buffer.
Step 220: and searching a key value list corresponding to the service data identification to be modified in the second cache region.
The first buffer calls a second buffer and sends the CacheName, the Saasid and the bizId to a second buffer area, and the second buffer searches whether Keylist (key value list) corresponding to the Saasid-bizId exists under the corresponding CacheName (storage space) in the second buffer area.
Step 230: and when the key value list corresponding to the service data identifier to be modified exists in the second cache region, deleting the key value list in the second cache region.
And deleting the Keylist (key value list) in the second cache region if the corresponding Keylist (key value list) exists in the second cache region.
Step 240: and deleting the corresponding key data in the key value list in the first cache region.
Besides deleting the Keylist in the second cache region, the reqKey (key data) specified in the Keylist needs to be deleted in the first cache region, so as to achieve the purpose of deleting all relevant cache data, reduce the cache occupation space, and delete the modified data in a targeted manner without affecting other data.
Fig. 8 is a flowchart illustrating a method for deleting cached data according to another exemplary embodiment of the present application, and as shown in fig. 8, the method for deleting cached data may include:
step 320: and determining key data to be deleted and a service data identifier to be deleted according to the deletion instruction.
When a service data record is newly added or deleted in the actual service, a certain range of cache invalidation is triggered. Therefore, firstly, the tenant server is called to execute the specific service operation of adding and deleting, then the cached deleting instruction is triggered, and the key data to be deleted and the service data identifier to be deleted are determined through the added or deleted service data record. The type of the service data can be obtained according to the deletion instruction, and a CacheName (storage space) and a saisid (tenant ID) corresponding to the type of the service data are obtained.
Step 330: and deleting the key data to be deleted and the query value corresponding to the key data to be deleted in the first cache region.
In a corresponding CacheName (storage space) in the first cache region, determining key data information to be deleted by using a prefix SaasId (tenant ID), so that all reqKey (key data) and Value (query Value) key-Value pairs with the prefixes of the SaasId (tenant ID) are deleted.
Step 340: and deleting the service data identification to be deleted and the key value list corresponding to the service data identification to be deleted in the second cache region.
In the corresponding CacheName (storage space) in the second cache region, the key data to be deleted is determined by the prefix SaasId (tenant ID), so that all the service data identifiers and key value list key value pairs with the prefixes of the SaasId (tenant ID) are deleted.
The data caching processing method of the SAAS tenant provided by the application has the following characteristics: 1. different service data are isolated by adopting a CacheName (storage space), so that different service caches do not influence each other. Such as caching user data and caching merchandise data without a relevant effect. 2. Saasid (tenant ID) is used as the prefix of each Key, so that the caches of different tenants are not influenced by each other. The tenants for which the cache data are aimed can be distinguished through Key prefixes. 3. And the influence on the set cache can be reduced by recording the set cache range influenced by the single record by the second cache. In this way, for the modification operation, a specific reqKey (key data) can be located through the KeyList generated by the second buffer, and only the related reqKey (key data) can be updated subsequently. For the new adding and deleting operations, although the reqKey (key data) of a specific influence cannot be located, the range of the influenced influence set is also reduced to a certain extent through the prefix of CacheName (storage space) and Saasid (tenant ID). Finally, the service cache data in the system is utilized to the maximum extent, and the performance of the system is fully improved.
Fig. 9 is a flowchart illustrating a method for querying cache data according to an exemplary embodiment of the present application, where as shown in fig. 9, the method for querying request data includes:
after the cache accessor obtains the query request of the upper layer client (step 30), one CacheName (storage space) is corresponding to the type of the service data, so that different service data operate in different service cachenames (storage spaces), and the CacheName (storage space) is similar to a certain Table concept of the database. Meanwhile, based on the SaasId (tenant ID), the requested page number, and ReqStr (request parameter), a reqKey (critical data) value is generated (step 31) in the format of SaasId-PageNo-ReqStr. And then issues a query request to the first cache.
And judging whether the reqKey value searched in the first buffer exists in the buffer or not (step 33).
If the reqKey exists, the corresponding Value is directly obtained from the cache (step 34), and the Value is returned to the cache accessor. And then the cache accessor transmits the data to the upper layer client application, and the request is finished.
If the reqKey Value does not exist, the first buffer transmits a request to the tenant server to perform a specific query operation, and a query result Value is obtained (step 35).
The first buffer calls the second buffer (step 36) and passes the reqKey and Value values described above. The second buffer analyzes the Value of Value to obtain the ID of each single record, i.e., bizld. Traversal is then performed for each bizId in Value (step 37).
Each SaasId-bizId is looked up as Key for the presence in the second buffer (step 38). If the Saasid-bizId does not exist, then KeyList is made equal to reqKey (step 43), and the Saasid-bizId and KeyList key-value pair are saved (step 42) and the next bizId is traversed. If the Saasid-bizId exists, the KeyList corresponding to the original Saasid-bizId is obtained (step 39).
It is determined whether the reqKey is contained in the KeyList (step 40). If reqKey is contained in KeyList, then no action is taken to traverse the next bizId. If the reqKey is not contained in the KeyList, the reqKey is comma separated and added to the end of the KeyList (step 41), then the Saasid-bizId and the new KeyList key-value pair are updated and saved (step 42) and the next bizId is traversed.
After the traversal completes the bizId, the traversal ends (step 44) and the second buffer call ends.
After the first buffer calls the second buffer, the first buffer stores the reqKey and the Value key Value pair of the query result (step 45), and returns the Value to the cache accessor. And then the cache accessor transmits the data to an upper layer client, and the request is finished.
Fig. 10 is a schematic flowchart of a method for modifying cache data according to another exemplary embodiment of the present application, and as shown in fig. 10, after an upper layer client sends a modification request, a cache accessor obtains the modification request (step 51), first invokes a tenant server to execute the modification request (step 52), and the tenant server performs a specific modification operation on business data of bizld and returns a modification result Value. Secondly, obtaining a CacheName according to the service data type, transmitting the CacheName, the SaasiD, the bizId and the Value values to a first buffer (step 53), and calling the first buffer (step 54).
The first cache calls the second cache (step 55) and passes the CacheName, SaasId, and bizId parameters.
In the second buffer, in the CacheName space, whether a buffer with the SaasId-bizId as the Key value exists is searched (step 56). If the SaasiD-bizId does not exist, the calling of the second buffer and the first buffer is finished, the buffer accessor returns a modification result Value to the upper-layer client, and the request is finished. If the Saasid-bizId exists, the corresponding KeyList is obtained (step 57). The key-value pair corresponding to the SaasId-bizId is then deleted from the cache and the KeyList is returned to the first cache (step 58).
The first buffer is separated and analyzed by commas according to the KeyList to obtain each specific reqKey. Traversing each reqKey Value (step 59), deleting the key Value pair corresponding to the reqKey in the cache (step 60), after the traversal is finished (step 61), completing the operation of the first cache (step 62) and feeding back to the cache accessor, after the operation of the first cache is finished, transmitting the Value to the upper-layer client application by the cache accessor, and finishing the request.
Fig. 11 is a flowchart illustrating a method for deleting cached data according to an exemplary embodiment of the present application, and as shown in fig. 11, after a cache accessor obtains a request for adding or deleting a record from an upper layer client (step 70), the cache accessor first calls a tenant server, and the tenant server executes the request for adding or deleting (step 71), and then triggers a next cache deletion instruction.
According to the type of the service data, obtaining the appointed CacheName (step 72), and deleting all caches with the prefixes of the SaasiD in the CacheName space, namely the reqKey-Value key-Value pair (step 73) in the first cache. All SaasiD-bizId-KeyList key-value pairs prefixed with SaasiD in the CacheName space are deleted in the second buffer (step 74), and the first buffer operation is completed (step 75).
After the above operations are completed, the cache accessor feeds back the request to the upper layer client, and the request is finished.
When the page number is specified in the query request in the above flow, the query request further includes a hidden parameter, which is the number of default record entries per page. This default number of entries per page is typically a system configuration parameter. However, if the system modifies this default configuration parameter, all of the first buffer and the second buffer need to be cleared, i.e., all of the Key-Value pairs of the first buffer and the second buffer need to be cleared.
Exemplary devices
Fig. 12 is a schematic structural diagram of an apparatus for caching data processing according to an exemplary embodiment of the present application, and as shown in fig. 12, the data caching processing apparatus 8 for SAAS tenant includes: a generating module 80, configured to generate key data according to the access request; wherein the access request comprises service data requested to be accessed; a first searching module 81, configured to search for a cache state of the key data in the first cache region; a first storage module 82, configured to store the critical data in the first cache region when the critical data is not cached in the first cache region; a second searching module 83, configured to search for a cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data; a second storing module 84, configured to store the service data identifier in the second cache region when the service data identifier is not cached in the second cache region.
The data caching processing device for the SAAS tenants adopts two modules to cache business data respectively, the second caching area can record an aggregation caching range influenced by a single piece of key data, the influence on the aggregation caching can be reduced, specific key data can be positioned in the second caching area, the caching data in the first caching area and the second caching area can be changed only by updating or deleting the key data subsequently, the performance of a system can be improved, and the problem of low performance during the caching of multi-tenant business data is solved.
The generating module 80 may be further configured to: determining the type of the service data and tenant information according to the access request; determining a corresponding storage space in the first cache region according to the type of the service data; and generating key data according to the access request, the corresponding storage space in the first cache region and the tenant information.
In an embodiment, the first storage module 81 may be further configured to: when the key data are not cached in the first cache region, inquiring in a tenant service region; the tenant business area can obtain a query value corresponding to each key data through the key data; storing the key data and the query value of the key data in the first cache region; wherein the key data and the query value form a key-value pair in the first cache region.
Fig. 13 is a schematic structural diagram of an apparatus for caching data processing according to another exemplary embodiment of the present application, and as shown in fig. 13, the data caching processing apparatus 8 for SAAS tenant may further include: and the analyzing module 85 is configured to analyze the query value of the key data to obtain a service data identifier corresponding to the query value.
In an embodiment, the second storage module 83 may be further configured to: when the service data identifier is not cached in the second cache region, converting key data corresponding to the service data identifier into a key value list; the service data identifier and the key value list form a key value pair in the second cache region; and storing the service data identification and the key value list into the second cache region.
In an embodiment, as shown in fig. 13, the data cache processing apparatus 8 for SAAS tenant may further include: the query module 86 is configured to query the existence state of the key data in the key value list corresponding to the service data identifier when the service data identifier is cached in the second cache region; a plurality of service data identifications and a plurality of key value lists respectively corresponding to the service data identifications are cached in the second cache region in advance, and the key value lists comprise a plurality of key data; an adding module 87, configured to add the key data to the key value list when the presence status indicates that the key data is not included in the key value list; a third storage module 88, configured to store the key value list after the key data is added and the service data identifier in the second cache region.
In an embodiment, as shown in fig. 13, the data cache processing apparatus 8 for SAAS tenant may further include: a modification determining module 89, configured to determine, according to the modification instruction, a service data identifier to be modified; a third searching module 90, configured to search a key value list corresponding to the service data identifier to be modified in the second cache region; a first deleting module 91, configured to delete the key value list in the second cache region when the key value list corresponding to the service data identifier to be modified exists in the second cache region; a second deleting module 92, configured to delete the corresponding key data in the key value list in the first cache region.
In an embodiment, as shown in fig. 13, the data cache processing apparatus 8 for SAAS tenant may further include: a deletion determining module 93, configured to determine, according to the deletion instruction, the key data to be deleted and the service data identifier to be deleted; a third deleting module 94, configured to delete the to-be-deleted key data and the query value corresponding to the to-be-deleted key data in the first cache region; a fourth deleting module 95, configured to delete the to-be-deleted service data identifier and the key value list corresponding to the to-be-deleted service data identifier in the second cache region.
Exemplary electronic device
Next, an electronic apparatus according to an embodiment of the present application is described with reference to fig. 14. The electronic device may be either or both of the first device and the second device, or a stand-alone device separate from them, which stand-alone device may communicate with the first device and the second device to receive the acquired input signals therefrom.
FIG. 14 illustrates a block diagram of an electronic device in accordance with an embodiment of the present application.
As shown in fig. 14, the electronic device 10 includes one or more processors 11 and a memory 12.
The processor 11 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device 10 to perform desired functions.
Memory 12 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium, and executed by the processor 11 to implement the data caching processing method for the SAAS tenant of the various embodiments of the present application described above and/or other desired functions. Various contents such as an input signal, a signal component, a noise component, etc. may also be stored in the computer-readable storage medium.
In one example, the electronic device 10 may further include: an input device 13 and an output device 14, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
When the electronic device is a stand-alone device, the input means 13 may be a communication network connector for receiving the acquired input signals from the first device and the second device.
The input device 13 may also include, for example, a keyboard, a mouse, and the like.
The output device 14 may output various information including the determined distance information, direction information, and the like to the outside. The output devices 14 may include, for example, a display, speakers, a printer, and a communication network and its connected remote output devices, among others.
Of course, for simplicity, only some of the components of the electronic device 10 relevant to the present application are shown in fig. 14, and components such as buses, input/output interfaces, and the like are omitted. In addition, the electronic device 10 may include any other suitable components depending on the particular application.
The computer program product may be written with program code for performing the operations of embodiments of the present application in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
The computer-readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, 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.
The foregoing description has been presented for purposes of illustration and description. Furthermore, the description is not intended to limit embodiments of the application to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize certain variations, modifications, alterations, additions and sub-combinations thereof.

Claims (10)

1. A data caching processing method for SAAS tenants is characterized by comprising the following steps:
generating key data according to the access request; wherein the access request comprises service data requested to be accessed;
searching the cache state of the key data in a first cache region;
when the key data are not cached in the first cache region, storing the key data into the first cache region;
searching the cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data;
and when the service data identification is not cached in the second cache region, storing the service data identification into the second cache region.
2. The method of claim 1, wherein generating critical data based on the access request comprises:
determining the type of the service data and tenant information according to the access request;
determining a corresponding storage space in the first cache region according to the type of the service data;
and generating key data according to the access request, the corresponding storage space in the first cache region and the tenant information.
3. The method of claim 1, wherein when the critical data is not cached in the first cache region, the storing the critical data into the first cache region comprises:
when the key data are not cached in the first cache region, inquiring in a tenant service region; the query value corresponding to each key data can be obtained through the key data in the tenant service area;
storing the key data and the query value of the key data in the first cache region; wherein the key data and the query value form a key-value pair in the first cache region.
4. The method according to claim 3, further comprising, before the searching for the cache status of the service data identifier in the second cache region:
and analyzing the query value of the key data to obtain a service data identifier corresponding to the query value.
5. The method of claim 1, wherein when the service data identifier is not cached in the second cache region, the storing the service data identifier in the second cache region comprises:
when the service data identifier is not cached in the second cache region, converting key data corresponding to the service data identifier into a key value list; the service data identifier and the key value list form a key value pair in the second cache region;
and storing the service data identification and the key value list into the second cache region.
6. The method according to claim 1, further comprising, after searching for the cache status of the service data identifier in the second cache region:
when the service data identification is cached in the second cache region, inquiring the existence state of the key data in a key value list corresponding to the service data identification; a plurality of service data identifications and a plurality of key value lists respectively corresponding to the service data identifications are cached in the second cache region in advance, and the key value lists comprise a plurality of key data;
when the presence status indicates that the key data is not included in the key value list, adding the key data to the key value list;
and storing the key value list after the key data is added and the service data identifier into the second cache region.
7. The method of claim 5, further comprising:
determining a service data identifier to be modified according to the modification instruction;
searching a key value list corresponding to the service data identification to be modified in the second cache region;
deleting the key value list in the second cache region when the key value list corresponding to the service data identifier to be modified exists in the second cache region;
and deleting the corresponding key data in the key value list in the first cache region.
8. The method of claim 5, further comprising:
determining key data to be deleted and a service data identifier to be deleted according to a deletion instruction;
deleting the key data to be deleted and the query value corresponding to the key data to be deleted in the first cache region;
and deleting the service data identification to be deleted and a key value list corresponding to the service data identification to be deleted in the second cache region.
9. A data caching processing device for SAAS tenants, comprising:
the generating module is used for generating key data according to the access request; wherein the access request comprises service data requested to be accessed;
the first searching module is used for searching the cache state of the key data in the first cache region;
the first storage module is used for storing the key data into the first cache region when the key data is not cached in the first cache region;
the second searching module is used for searching the cache state of the service data identifier in the second cache region; the business data identification is obtained by analyzing the query value of the key data;
and the second storage module is used for storing the service data identifier into the second cache region when the service data identifier is not cached in the second cache region.
10. A computer-readable storage medium storing a computer program for executing the data caching method for SAAS tenants according to any one of claims 1 to 8.
CN202110940240.XA 2021-08-17 Data caching processing method, device and medium for SAAS tenant Active CN113641711B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110940240.XA CN113641711B (en) 2021-08-17 Data caching processing method, device and medium for SAAS tenant

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110940240.XA CN113641711B (en) 2021-08-17 Data caching processing method, device and medium for SAAS tenant

Publications (2)

Publication Number Publication Date
CN113641711A true CN113641711A (en) 2021-11-12
CN113641711B CN113641711B (en) 2024-05-31

Family

ID=

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
CN105786918A (en) * 2014-12-26 2016-07-20 亿阳信通股份有限公司 Data loading storage space-based data query method and device
CN106126113A (en) * 2016-06-14 2016-11-16 烽火通信科技股份有限公司 A kind of method of home gateway service data classification storage management
CN106294521A (en) * 2015-06-12 2017-01-04 交通银行股份有限公司 Date storage method and data warehouse
CN107622115A (en) * 2017-09-19 2018-01-23 武大吉奥信息技术有限公司 A kind of space querying result cache method towards WFS services
CN110597739A (en) * 2019-06-03 2019-12-20 上海云盾信息技术有限公司 Configuration management method, system and equipment
CN110597859A (en) * 2019-09-06 2019-12-20 天津车之家数据信息技术有限公司 Method and device for querying data in pages
CN112487037A (en) * 2020-12-08 2021-03-12 平安国际智慧城市科技股份有限公司 Cache data processing method and device, computer equipment and storage medium

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
CN105786918A (en) * 2014-12-26 2016-07-20 亿阳信通股份有限公司 Data loading storage space-based data query method and device
CN106294521A (en) * 2015-06-12 2017-01-04 交通银行股份有限公司 Date storage method and data warehouse
CN106126113A (en) * 2016-06-14 2016-11-16 烽火通信科技股份有限公司 A kind of method of home gateway service data classification storage management
CN107622115A (en) * 2017-09-19 2018-01-23 武大吉奥信息技术有限公司 A kind of space querying result cache method towards WFS services
CN110597739A (en) * 2019-06-03 2019-12-20 上海云盾信息技术有限公司 Configuration management method, system and equipment
CN110597859A (en) * 2019-09-06 2019-12-20 天津车之家数据信息技术有限公司 Method and device for querying data in pages
CN112487037A (en) * 2020-12-08 2021-03-12 平安国际智慧城市科技股份有限公司 Cache data processing method and device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
罗桂琼: "云计算环境下教育信息化资源共建共享研究", 吉林人民出版社, pages: 9 *

Similar Documents

Publication Publication Date Title
US11645210B2 (en) Cache aware searching based on one or more files in remote storage
CN107247808B (en) Distributed NewSQL database system and picture data query method
US6832227B2 (en) Database management program, a database managing method and an apparatus therefor
US8868595B2 (en) Enhanced control to users to populate a cache in a database system
JP2003006036A (en) Clustered application server and web system having database structure
US20140046928A1 (en) Query plans with parameter markers in place of object identifiers
US11762775B2 (en) Systems and methods for implementing overlapping data caching for object application program interfaces
US20160063107A1 (en) Data retrieval via a telecommunication network
CN109815240B (en) Method, apparatus, device and storage medium for managing index
US11093496B1 (en) Performance-based query plan caching
CN114116613A (en) Metadata query method, equipment and storage medium based on distributed file system
CN114201505A (en) Data query method and device and database system
US8396858B2 (en) Adding entries to an index based on use of the index
CN114443615A (en) Database management system, related apparatus, method and medium
US8200673B2 (en) System and method for on-demand indexing
US11030177B1 (en) Selectively scanning portions of a multidimensional index for processing queries
CN113641711B (en) Data caching processing method, device and medium for SAAS tenant
CN113641711A (en) Data caching processing method, device and medium for SAAS tenant
CN113051244B (en) Data access method and device, and data acquisition method and device
CN115438066A (en) Data retrieval processing method and system
CN113987321A (en) Page implementation method and device based on React frame, electronic equipment and storage medium
CN110909029A (en) Method and medium for realizing cache based on Nosql
CN113806090B (en) Big data job operation method and system based on Alluxio
US20240078237A1 (en) Database Join Operations With Early Filtering
CN114356292A (en) Interactive information processing method and device and computer equipment

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