Package org.apache.ibatis.annotations
Annotation Interface CacheNamespace
The annotation that specify to use cache on namespace(e.g. mapper interface).
How to use:
@CacheNamespace(implementation = CustomCache.class, properties = {
@Property(name = "host", value = "${mybatis.cache.host}"),
@Property(name = "port", value = "${mybatis.cache.port}"),
@Property(name = "name", value = "usersCache")
})
public interface UserMapper {
// ...
}
- Author:
- Clinton Begin, Kazuki Shimizu
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanReturns whether block the cache at request time or not.Returns the cache evicting implementation type to use.longReturns the flush interval.Returns the cache implementation type to use.Property[]Returns property values for a implementation object.booleanReturns whether use read/write cache.intReturn the cache size.
-
Element Details
-
implementation
Returns the cache implementation type to use.- Returns:
- the cache implementation type
- Default:
org.apache.ibatis.cache.impl.PerpetualCache.class
-
eviction
Returns the cache evicting implementation type to use.- Returns:
- the cache evicting implementation type
- Default:
org.apache.ibatis.cache.decorators.LruCache.class
-
flushInterval
long flushIntervalReturns the flush interval.- Returns:
- the flush interval
- Default:
0L
-
size
int sizeReturn the cache size.- Returns:
- the cache size
- Default:
1024
-
readWrite
boolean readWriteReturns whether use read/write cache.- Returns:
trueif use read/write cache;falseif otherwise
- Default:
true
-
blocking
boolean blockingReturns whether block the cache at request time or not.- Returns:
trueif block the cache;falseif otherwise
- Default:
false
-
properties
Property[] propertiesReturns property values for a implementation object.- Returns:
- property values
- Since:
- 3.4.2
- Default:
{}
-