public interface StorageCache
Default implementation is StorageMemoryCache
Do Object <--> String serialization/deserialization takes time,
especially when there has frequent calls of StorageExt.get(StorageKey),
performance problem will come out.
Using cache is always a good practice to reduce the number of serialization/deserialization.
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear cache
|
<T> boolean |
containsValue(T value)
Test if this Cache contains a value.
|
<T> T |
get(StorageKey<T> key)
Returns the value in this Cache associated with the specified key.
|
<T> T |
put(StorageKey<T> key,
T value)
Cache the specified value with the specified key.
|
<T> T |
remove(StorageKey<T> key)
Removes the cached value for the specified key from this cache if present.
|
void clear()
<T> boolean containsValue(T value)
T - type of the given valuevalue - the value whose presence in this storage is to be tested<T> T get(StorageKey<T> key)
null if this Cache contains no cached value for the key.T - type of value which will be returnedkey - the key to a value in the Cache<T> T put(StorageKey<T> key, T value)
T - type of given valuekey - key with which the specified value is to be cachedvalue - value to be cached<T> T remove(StorageKey<T> key)
T - type of given valuekey - key whose value is to be removed from the cacheCopyright © 2018 seanchenxi.com. All rights reserved.