Caching method and device for shopping mall data consistency

By setting cache annotations and encryption and decryption servers in the mall data cache system, the problems of high memory usage, large system complexity and difficult to guarantee data consistency in the mall data cache are solved, and efficient and secure data consistency and cache management are achieved.

CN119917508APending Publication Date: 2025-05-02ZIXUN TECHNOLOGY (FUJIAN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411814405.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The existing technology has problems such as high memory footprint, large system complexity and difficult to guarantee data consistency in the mall data cache, especially when user sensitive data leaks, which may lead to serious economic losses and reputation damage.

Method used

By setting cache read-only annotations, cache write annotations and cache delete annotations on the mall server and micro server, we ensure that the data provider is responsible for cache consistency and the data caller does not need to pay attention. At the same time, the encryption and decryption server and the key storage server are used to ensure that each user's data is encrypted and stored using an independent key.

Benefits of technology

It realizes that while maintaining cache performance, ensuring data consistency, reducing system complexity, and greatly increasing data security, avoiding the risks brought about by user sensitive data leakage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119917508A_ABST
    Figure CN119917508A_ABST
Patent Text Reader

Abstract

The invention provides a caching method and device for shopping mall data consistency. The method comprises the following steps: setting a cache read-only annotation, a cache write-in annotation and a cache deletion annotation; the client sends request data to the shopping mall server; the shopping mall server uses the cache read-only annotation to query commodity data from the shopping mall cache according to the request data; if so, directly returning to the client; if not, the shopping mall server side sends the request data to a shopping mall micro server side, and the shopping mall micro server side obtains commodity data from a shopping mall database according to the request data, writes an annotation through a cache, writes the commodity data into a shopping mall cache, and sends the commodity data to the shopping mall server side; and the shopping mall server receives and forwards the data to the client, so that the consistency of the cached data is ensured, the consistency of the data is ensured while the original performance of the cache is maintained, and the complexity of the system is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data cache security technology, and in particular to a cache method and device for mall data consistency. Background Art

[0002] In the process of Web software development, data caching is a commonly used technology. By storing frequently accessed data in memory, repeated database queries or remote calls are avoided, which reduces the pressure on the database, reduces the traffic of the internal network, and speeds up the response of the system. It can significantly improve the user experience and overall system performance, and save system resources.

[0003] Disadvantages of the above caching methods: 1. Memory usage: There will be additional memory usage; 2. System complexity: Each module must consider which data needs to be cached and carry out corresponding software design and development. If the cache service is shared, there may be conflicts, which increases the difficulty of developing and maintaining the overall system; 3. Data consistency: The cached data and the actual data may be inconsistent, causing users to see historical data, making wrong decisions or causing business problems.

[0004] In addition, user data is stored in the cloud, and data leakage incidents occur frequently, especially those involving sensitive user data, which may lead to serious economic losses and reputation damage. Summary of the invention

[0005] The technical problem to be solved by the present invention is to provide a caching method and device for mall data consistency, which ensures data consistency and reduces system complexity while maintaining the original performance of the cache.

[0006] In a first aspect, the present invention provides a caching method for mall data consistency, including a client, a mall server, a mall microservice, a mall cache, and a mall database, specifically comprising the following steps:

[0007] Step 1: Set a cache read-only annotation, a cache write annotation, and a cache delete annotation. The cache read-only annotation is set on the mall server, and the cache write annotation and cache delete annotation are set on the mall microservice.

[0008] Step 2: The client sends request data to the mall server;

[0009] Step 3: The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it returns directly to the client; if it does not exist, the mall server sends the request data to the mall microservice, and the mall microservice obtains the product data from the mall database according to the request data, writes the product data to the mall cache through the cache write annotation, and sends the product data to the mall server;

[0010] Step 4: The mall server receives and forwards it to the client.

[0011] In a second aspect, the present invention provides a cache device for mall data consistency, including a client, a mall server, a mall microservice, a mall cache, and a mall database, specifically including the following modules:

[0012] A setting module is used to set cache read-only annotations, cache write annotations and cache delete annotations. The cache read-only annotations are set on the mall server, and the cache write annotations and cache delete annotations are set on the mall microservice end;

[0013] Request module, the client sends request data to the mall server;

[0014] In the data acquisition module, the mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice end, and the mall microservice end will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server end;

[0015] Return data module, the mall server receives and forwards it to the client.

[0016] One or more technical solutions provided by the present invention have at least the following technical effects or advantages:

[0017] The data provider of the present invention is responsible for cache consistency, and the data caller does not need to pay attention to it; only one copy is stored in the cache to reduce unnecessary memory usage; the code invasion is low, and annotations are sufficient, and it is fully compatible with Spring Cache; it supports extension and batch expiration of cache;

[0018] The present invention encrypts the data uploaded by the client and then stores it; and the decryption key used for each user's data is different, so even if one user's data is decrypted, it will not affect the data security of other users; the location where the data is stored is different from the location where it is encrypted and decrypted, so even if a server is hacked, it will not cause data leakage, which greatly increases data security.

[0019] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0021] Figure 1 is a flow chart of the method in Embodiment 1 of the present invention;

[0022] Figure 2 It is a schematic diagram of the structure of the device in the second embodiment of the present invention. DETAILED DESCRIPTION

[0023] The technical solution in the embodiment of the present application has the following general idea:

[0024] 1. The data provider is responsible for maintaining the cache and ensuring cache consistency;

[0025] 2. The caller of the data can only read the cache but cannot edit or delete it;

[0026] 3. Use code annotation to hack, the transformation cost is low:

[0027] a) The data provider needs to add a cache write annotation in the API declaration;

[0028] Add a cache expiration annotation where the data is modified or deleted;

[0029] b) The data caller only needs to add a cache read annotation at the API call;

[0030] c) The data provider and the data caller declare the same cache storage configuration as agreed, such as the Redis cache service;

[0031] Taking Java's SpringBoot technology framework as an example, the implementation instructions are:

[0032] 1. Define 3 annotations:

[0033] a) Cache read-only annotations:

[0034] i. Inherits from org.springframework.cache.annotation.Cacheable;

[0035] ii. Force setting unless to true to achieve cache read-only effect;

[0036] iii. Add the field provider, which refers to the module name of the data provider;

[0037] b) Cache write annotation:

[0038] i. Inherits from org.springframework.cache.annotation.Cacheable;

[0039] ii. Force setting unless to false to allow writing to the cache;

[0040] c) Cache deletion annotation:

[0041] i. Inherited from org.springframework.cache.annotation.CacheEvict;

[0042] ii. Force setting unless to false to allow writing to cache

[0043] 2. Define the cache configuration class and read the cache configuration in the configuration file, such as the IP port of Redis, to unify the cache data reading and writing; for example, the Java project is the application.yml configuration file;

[0044] 3. Add global cache parsing class (SDK):

[0045] i. Inherited from org.springframework.cache.annotation.CacheAnnotationParser

[0046] b) Implement the method parseCacheAnnotations, scan all methods using the above three annotations and return the method list; add the AOP aspect interception class of the above three annotations to implement read-only operations, write operations or delete operations.

[0047] Embodiment 1

[0048] like Figure 1 As shown, this embodiment provides a cache method for mall data consistency, which is characterized by comprising a client, a mall server, a mall microservice, a mall cache and a mall database, and specifically comprises the following steps:

[0049] Step 1: Set a cache read-only annotation, a cache write annotation, and a cache delete annotation. The cache read-only annotation is set on the mall server, and the cache write annotation and cache delete annotation are set on the mall microservice.

[0050] Step 2: The client sends request data to the mall server;

[0051] Step 3: The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it returns directly to the client; if it does not exist, the mall server sends the request data to the mall microservice, and the mall microservice obtains the product data from the mall database according to the request data, writes the product data to the mall cache through the cache write annotation, and sends the product data to the mall server;

[0052] Step 4: The mall server receives and forwards it to the client.

[0053] In this embodiment, preferably, the cache read-only annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is true to achieve cache read-only;

[0054] The cache write annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is false, allowing write operations;

[0055] The cache deletion annotation is specifically: inherited from org.springframework.cache.annotation.CacheEvict; mandatory setting unless is false, allowing deletion operations;

[0056] Define the cache configuration class, read the cache configuration in the configuration file, and use it to unify the reading, writing, and deletion of cached data in the mall;

[0057] Add a global cache parsing class: inherit from org.springframework.cache.annotation.CacheAnnotationParser; implement the method parseCacheAnnotations, scan all methods that use the cache read-only annotation, cache write annotation, and cache delete annotation, and return the method list; add the AOP aspect interception class of the cache read-only annotation, cache write annotation, and cache delete annotation to implement read-only operation, write operation, or delete operation;

[0058] The cache configuration class and the global cache parsing class are set in the mall server and the mall micro-service end; so that the mall server end implements read-only operations on the mall cache and cannot perform write operations or delete operations; the mall micro-service end implements write operations and delete operations on the mall cache.

[0059] This embodiment preferably also includes an encryption and decryption server and a key storage service, and step 1 is specifically as follows: the client uploads user data, and the mall server receives the user data; the mall server queries and obtains the corresponding first user ID according to the client account, and the mall server sends the user data and the first user ID to the encryption and decryption server; the encryption and decryption server receives the user data and the first user ID; the encryption and decryption server obtains the corresponding first secret key from the key storage service according to the first user ID. If the first secret key does not exist, the encryption and decryption server generates a random string of a set number of bits, generates a first key through a hash algorithm based on the first user ID and the random string, and encrypts the user data through the AES encryption algorithm through the first key to obtain to the first encrypted data, and then send the encrypted data to the mall server, and store the first key to the key storage service end; if the first secret key exists, the encryption and decryption server encrypts the user data by the first key to obtain the first encrypted data, and then sends the encrypted data to the mall server; the encryption and decryption server deletes the first key and the first user ID; the mall server forwards the first encrypted data to the mall microservice end, and the mall microservice end stores the first encrypted data in the mall database; set a cache read-only annotation, a cache write annotation and a cache delete annotation, the cache read-only annotation is set on the mall server, and the cache write annotation and the cache delete annotation are set on the mall microservice end.

[0060] In this embodiment, preferably, step 3 is specifically:

[0061] The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice, and the mall microservice will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server;

[0062] Alternatively, the mall server uses the cache read-only annotation to query the mall cache for user data according to the request data; the mall server sends the request data and the second user ID to the mall microservice, and the mall microservice obtains the corresponding second encrypted data from the mall database according to the request data, and sends the second encrypted data and the second user ID to the encryption and decryption server; the encryption and decryption server obtains the second key from the key storage service end through the second user ID, decrypts the second encrypted data through the second key to obtain the decrypted data, and then sends the decrypted data to the mall microservice, writes the decrypted data to the mall cache through the cache write annotation, and sends the decrypted data to the mall server.

[0063] In this embodiment, preferably, step 5 is also included. When the mall microservice end modifies or deletes the data in the mall database, the corresponding data in the mall cache is synchronized, that is, the modification or deletion is performed synchronously to ensure that the data in the mall cache is the latest.

[0064] Based on the same inventive concept, the present application also provides a device corresponding to the method in Example 1, see Example 2 for details.

[0065] Embodiment 2

[0066] like Figure 2 As shown, in this embodiment, a cache device for mall data consistency is provided, including a client, a mall server, a mall microservice, a mall cache and a mall database, specifically including the following modules:

[0067] A setting module is used to set cache read-only annotations, cache write annotations and cache delete annotations. The cache read-only annotations are set on the mall server, and the cache write annotations and cache delete annotations are set on the mall microservice end;

[0068] Request module, the client sends request data to the mall server;

[0069] In the data acquisition module, the mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice end, and the mall microservice end will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server end;

[0070] Return data module, the mall server receives and forwards it to the client.

[0071] In this embodiment, preferably, the cache read-only annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is true to achieve cache read-only;

[0072] The cache write annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is false, allowing write operations;

[0073] The cache deletion annotation is specifically: inherited from org.springframework.cache.annotation.CacheEvict; mandatory setting unless is false, allowing deletion operations;

[0074] Define the cache configuration class, read the cache configuration in the configuration file, and use it to unify the reading, writing, and deletion of cached data in the mall;

[0075] Add a global cache parsing class: inherit from org.springframework.cache.annotation.CacheAnnotationParser; implement the method parseCacheAnnotations, scan all methods that use the cache read-only annotation, cache write annotation, and cache delete annotation, and return the method list; add the AOP aspect interception class of the cache read-only annotation, cache write annotation, and cache delete annotation to implement read-only operation, write operation, or delete operation;

[0076] The cache configuration class and the global cache parsing class are set in the mall server and the mall micro-service end; so that the mall server end implements read-only operations on the mall cache and cannot perform write operations or delete operations; the mall micro-service end implements write operations and delete operations on the mall cache.

[0077] In this embodiment, preferably, it also includes an encryption and decryption server and a key storage service. The setting module is specifically as follows: the client uploads user data, and the mall server receives the user data; the mall server queries and obtains the corresponding first user ID according to the client account, and the mall server sends the user data and the first user ID to the encryption and decryption server; the encryption and decryption server receives the user data and the first user ID; the encryption and decryption server obtains the corresponding first secret key from the key storage service according to the first user ID. If the first secret key does not exist, the encryption and decryption server generates a random string of a set number of bits, generates a first key through a hash algorithm according to the first user ID and the random string, and encrypts the user data through an AES encryption algorithm through the first key. Obtain the first encrypted data, then send the encrypted data to the mall server, and store the first key in the key storage service end; if the first secret key exists, the encryption and decryption server encrypts the user data by the first key to obtain the first encrypted data, and then sends the encrypted data to the mall server; the encryption and decryption server deletes the first key and the first user ID; the mall server forwards the first encrypted data to the mall microservice end, and the mall microservice end stores the first encrypted data in the mall database; set a cache read-only annotation, a cache write annotation and a cache delete annotation, the cache read-only annotation is set on the mall server, and the cache write annotation and the cache delete annotation are set on the mall microservice end.

[0078] In this embodiment, preferably, the data acquisition module is specifically:

[0079] The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice, and the mall microservice will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server;

[0080] Alternatively, the mall server uses the cache read-only annotation to query the mall cache for user data according to the request data; the mall server sends the request data and the second user ID to the mall microservice, and the mall microservice obtains the corresponding second encrypted data from the mall database according to the request data, and sends the second encrypted data and the second user ID to the encryption and decryption server; the encryption and decryption server obtains the second key from the key storage service end through the second user ID, decrypts the second encrypted data through the second key to obtain the decrypted data, and then sends the decrypted data to the mall microservice, writes the decrypted data to the mall cache through the cache write annotation, and sends the decrypted data to the mall server.

[0081] Since the device introduced in the second embodiment of the present invention is a device used to implement the method of the first embodiment of the present invention, those skilled in the art can understand the specific structure and deformation of the device based on the method introduced in the first embodiment of the present invention, so it is not described here in detail. All devices used in the method of the first embodiment of the present invention belong to the scope of protection of the present invention.

[0082] In this embodiment, preferably, an update module is also included. When the mall microservice end modifies or deletes the data in the mall database, the corresponding data in the mall cache is synchronized, that is, the modification or deletion is performed synchronously to ensure that the data in the mall cache is the latest.

[0083] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:

[0084] The data provider in this embodiment is responsible for cache consistency, and the data caller does not need to pay attention to it; only one copy is stored in the cache to reduce unnecessary memory usage; the code is less invasive and only requires annotations, and is fully compatible with Spring Cache; it supports extension and batch expiration of cache;

[0085] Data security: Encrypted data storage ensures that data is not leaked even in the event of a database leak. At the same time, independent encryption and decryption servers reduce the risk of keys and data being exposed in applications; independent keys are assigned to each user to ensure that even if a key is leaked, it will not affect the data security of other users.

[0086] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A cache method for mall data consistency, characterized by: Including the client, mall server, mall microservice, mall cache and mall database, specifically including the following steps: Step 1: Set a cache read-only annotation, a cache write annotation, and a cache delete annotation. The cache read-only annotation is set on the mall server, and the cache write annotation and cache delete annotation are set on the mall microservice. Step 2: The client sends request data to the mall server; Step 3: The mall server uses the cache read-only annotation to query the mall cache for product data based on the request data; if the data exists, it is returned directly to the client; If it does not exist, the mall server sends the request data to the mall microservice end, and the mall microservice end obtains the product data from the mall database according to the request data, writes the product data to the mall cache through the cache write annotation, and sends the product data to the mall server end; Step 4: The mall server receives and forwards it to the client.

2. A cache method for mall data consistency according to claim 1, characterized in that: The cache read-only annotation is specifically: inherited from org.springframework.cache.annot ation.Cacheable; mandatory setting unless is true to achieve cache read-only; The cache write annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is false, allowing write operations; The cache deletion annotation is specifically: inherited from org.springframework.cache.annotation.CacheEvict; mandatory setting unless is false, allowing deletion operations; Define the cache configuration class, read the cache configuration in the configuration file, and use it to unify the reading, writing, and deletion of cached data in the mall; Add a global cache parsing class: inherit from org.springframework.cache.annotation.CacheAnnotationParser; implement the method parseCacheAnnotations, scan all methods that use the cache read-only annotation, cache write annotation, and cache delete annotation, and return the method list; add the AOP aspect interception class of the cache read-only annotation, cache write annotation, and cache delete annotation to implement read-only operation, write operation, or delete operation; The cache configuration class and the global cache parsing class are set on the mall server and the mall microservice.

3. A cache method for mall data consistency according to claim 1, characterized in that: It also includes an encryption and decryption server and a key storage service. Step 1 is specifically as follows: the client uploads user data, and the mall server receives the user data; the mall server queries and obtains the corresponding first user ID based on the client account, and the mall server sends the user data and the first user ID to the encryption and decryption server; the encryption and decryption server receives the user data and the first user ID; the encryption and decryption server obtains the corresponding first secret key from the key storage service based on the first user ID. If the first secret key does not exist, the encryption and decryption server generates a random string of a set number of bits, and generates a first key through a hash algorithm based on the first user ID and the random string. , encrypt the user data through the AES encryption algorithm using the first key to obtain first encrypted data, then send the encrypted data to the mall server, and store the first key in the key storage service end; if the first secret key exists, the encryption and decryption server encrypts the user data through the first key to obtain first encrypted data, and then sends the encrypted data to the mall server; the encryption and decryption server deletes the first key and the first user ID; the mall server forwards the first encrypted data to the mall micro service end, and the mall micro service end stores the first encrypted data in the mall database; A cache read-only annotation, a cache write annotation, and a cache delete annotation are set. The cache read-only annotation is set on the mall server, and the cache write annotation and cache delete annotation are set on the mall microservice.

4. A cache method for mall data consistency according to claim 3, characterized in that: The step 3 is specifically as follows: The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice, and the mall microservice will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server; Alternatively, the mall server uses the cache read-only annotation to query the mall cache for user data according to the request data; the mall server sends the request data and the second user ID to the mall microservice, and the mall microservice obtains the corresponding second encrypted data from the mall database according to the request data, and sends the second encrypted data and the second user ID to the encryption and decryption server; the encryption and decryption server obtains the second key from the key storage service end through the second user ID, decrypts the second encrypted data through the second key to obtain the decrypted data, and then sends the decrypted data to the mall microservice, writes the decrypted data to the mall cache through the cache write annotation, and sends the decrypted data to the mall server.

5. A cache method for mall data consistency according to claim 1, characterized in that: It also includes step 5: when the mall microservice modifies or deletes the data in the mall database, the corresponding data in the mall cache is synchronized.

6. A cache device for mall data consistency, characterized by: It includes the client, mall server, mall microservice, mall cache and mall database, and specifically includes the following modules: A setting module is used to set cache read-only annotations, cache write annotations and cache delete annotations. The cache read-only annotations are set on the mall server, and the cache write annotations and cache delete annotations are set on the mall microservice end; Request module, the client sends request data to the mall server; Get data module. The mall server uses the cache read-only annotation to query the mall cache for product data based on the request data. If the data exists, it will be returned directly to the client. If it does not exist, the mall server sends the request data to the mall microservice end, and the mall microservice end obtains the product data from the mall database according to the request data, writes the product data to the mall cache through the cache write annotation, and sends the product data to the mall server end; Return data module, the mall server receives and forwards it to the client.

7. A cache device for mall data consistency according to claim 6, characterized in that: The cache read-only annotation is specifically: inherited from org.springframework.cache.annot ation.Cacheable; mandatory setting unless is true to achieve cache read-only; The cache write annotation is specifically: inherited from org.springframework.cache.annotation.Cacheable; mandatory setting unless is false, allowing write operations; The cache deletion annotation is specifically: inherited from org.springframework.cache.annotation.CacheEvict; mandatory setting unless is false, allowing deletion operations; Define the cache configuration class, read the cache configuration in the configuration file, and use it to unify the reading, writing, and deletion of cached data in the mall; Add a global cache parsing class: inherit from org.springframework.cache.annotation.CacheAnnotationParser; implement the method parseCacheAnnotations, scan all methods that use the cache read-only annotation, cache write annotation, and cache delete annotation, and return the method list; add the AOP aspect interception class of the cache read-only annotation, cache write annotation, and cache delete annotation to implement read-only operation, write operation, or delete operation; The cache configuration class and the global cache parsing class are set on the mall server and the mall microservice.

8. A cache device for mall data consistency according to claim 6, characterized in that: It also includes an encryption and decryption server and a key storage service. The setting module is specifically as follows: the client uploads user data, and the mall server receives the user data; the mall server queries and obtains the corresponding first user ID based on the client account, and the mall server sends the user data and the first user ID to the encryption and decryption server; the encryption and decryption server receives the user data and the first user ID; the encryption and decryption server obtains the corresponding first secret key from the key storage service based on the first user ID. If the first secret key does not exist, the encryption and decryption server generates a random string of a set number of bits, and generates a first key through a hash algorithm based on the first user ID and the random string , encrypt the user data through the AES encryption algorithm using the first key to obtain first encrypted data, then send the encrypted data to the mall server, and store the first key in the key storage service end; if the first secret key exists, the encryption and decryption server encrypts the user data through the first key to obtain first encrypted data, and then sends the encrypted data to the mall server; the encryption and decryption server deletes the first key and the first user ID; the mall server forwards the first encrypted data to the mall micro service end, and the mall micro service end stores the first encrypted data in the mall database; A cache read-only annotation, a cache write annotation, and a cache delete annotation are set, wherein the cache read-only annotation is set on the mall server, and the cache write annotation and the cache delete annotation are set on the mall microservice.

9. A cache device for mall data consistency according to claim 8, characterized in that: The data acquisition module is specifically: The mall server uses the cache read-only annotation to query the mall cache for product data according to the request data; if it exists, it will be directly returned to the client; if it does not exist, the mall server will send the request data to the mall microservice, and the mall microservice will obtain the product data from the mall database according to the request data, write the product data to the mall cache through the cache write annotation, and send the product data to the mall server; Alternatively, the mall server uses the cache read-only annotation to query the mall cache for user data according to the request data; the mall server sends the request data and the second user ID to the mall microservice, and the mall microservice obtains the corresponding second encrypted data from the mall database according to the request data, and sends the second encrypted data and the second user ID to the encryption and decryption server; the encryption and decryption server obtains the second key from the key storage service end through the second user ID, decrypts the second encrypted data through the second key to obtain the decrypted data, and then sends the decrypted data to the mall microservice, writes the decrypted data to the mall cache through the cache write annotation, and sends the decrypted data to the mall server.

10. A cache device for mall data consistency according to claim 6, characterized in that: It also includes an update module. When the mall microservice modifies or deletes data in the mall database, it synchronizes the corresponding data in the mall cache.