Brief introduction
Simple-spring-memcached is an integrated use of spring and xmemcached. Use the cache in annotations.
Official address
Http://code.google.com/p/simple-spring-memcached/wiki/UserGuide
Note Notes
http://blog.csdn.net/a9529lty/article/details/8529432
Instructions for use
http://www.colorfuldays.org/tag/simple-spring-memcached/
Code Design Ideas
In the Userdao class, when adding or deleting changes, print out an action message to indicate that the code passed.
If there is a cache, the action is not printed.
In addition, the userdatabase simulates the behavior of the database, at the initial time, there is a id=1 record.
Introduction to Annotations
For entities, you need to annotate on the method @cachekeymethod indicates which key is used as the cache
For the DAO layer, the main requirements are 3 kinds of annotations
Add or update cache objects and persistence layers: @UpdateSingleCache (Namespace = "User", expiration = 3600)
Reads the cache and reads the persistence layer if the cache does not exist: @ReadThroughSingleCache (Namespace = "User", expiration = 0)
To delete data for the cache and Persistence layer: @InvalidateSingleCache (namespace = "User")
which
The @ParameterValueKeyProvider represents the key, and the Cachekeymethod class is labeled
@ParameterDataUpdateContent represents content
Other details are written in the code, and you can study and discuss them together.
Spring3.2.5-xmemcached-1.4.2_simple-spring.zip (9.3 KB)
From Iteye, Author: 85977328
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/tools/