About the use of caching
Preface
problems: the current system, each have a habit of using the cache, storage directory is also inconsistent; secondly there is no flexible caching mechanism.
In order to better promote the business, optimizing the system architecture for the development of the following specifications cache
Cache type
1. fever, without modifying the data, the local cache. Each distribution system to establish a centralized buffer alone.
2. high fever, low frequency data, redis cache. Use @CacheAnnotation annotation achieve.
3. The heat, high frequency data, db storage.
Program
For more different scenarios, cache classified. Scheme given below in detail.
1. Local cache
Local object caching, do not do too much to explain here
- Requirements: Each centralized distribution project to establish an independent local cache
payment.package: com.bgy.robot.payment.paymentservices.service.localcache
bussiness.package: com.bgy.robot.order.business.service.localcache
2.redis Cache
Certain key values are stored in the specified time redis
- Requirements: 1 designated distribution points each item separate buffer;.
Such as: common: base: province: common resource representation / Basic information / provinces
such as: payment: card: pay: code : represents payment module / membership card / payment / QR code- Requirements: 2.redis cached data must specify a survival time;
how to use @CacheAnnotation , please refer https://www.cnblogs.com/yun965861480/p/11314315.html
3.db Cache
db database storage just like our current operating same.