Package com.skava.service.impl
Class CacheImpl
java.lang.Object
com.skava.service.impl.CacheImpl
This service class handles the Cache request and process it by clearing all the cache, cache clear by cache name
alone and cache clear by cache name and key.
- Author:
- Infosys Equinox
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearCache
(Set<String> cacheNames) This method is used to delete the cache by cache name.<P> Object
covertObj
(P value) This method is used to convert the given value to object.deleteCache
(String cacheName) This is used to delete the cache with cache name.deleteCacheWithKey
(String cacheName, String cacheKey) This is used to delete cache with cache name and key.org.springframework.cache.Cache
This method is used to get cache with cache name.getValueFromCache
(String cacheName, String key) This method is used to gets the Object value from cache according to the given cache name and key.<T> Object
saveDetailsToCache
(String cacheName, String cacheKey, T entity) This is user to save details in cache.
-
Constructor Details
-
CacheImpl
public CacheImpl()Default constructor.
-
-
Method Details
-
getCache
This method is used to get cache with cache name.- Parameters:
cacheName
- Indicates the cache name for loading the cache with cache name.- Returns:
- The
Cache
object.
-
covertObj
This method is used to convert the given value to object. Removed: return objectMapper.convertValue(value, value.getClass()); Based on object type in previous versions, same object is returned. Returning rawType from jackson-databind is removed in newer versions. Hence the conversion is not needed in latest version.- Parameters:
value
- Holds value for converting value to object.- Returns:
Object value.
-
saveDetailsToCache
This is user to save details in cache.- Parameters:
cacheName
- Indicates the cache name. Instance ofString
object which is used for saving details in cache.cacheKey
- Indicates the cache key. Instance ofString
object which is used for saving details in cache.entity
- aCacheImpl
object used for saving details in cache.- Returns:
- A
Object
object.
-
deleteCacheWithKey
This is used to delete cache with cache name and key.- Parameters:
cacheName
- Holds cache name used for deleting cache with name and key.cacheKey
- Holds cache key used for deleting cache with name and key..- Returns:
- A
Object
object.
-
deleteCache
This is used to delete the cache with cache name. -
clearCache
This method is used to delete the cache by cache name.- Parameters:
cacheNames
- indicates the cache names for clearing the cache.
-
getValueFromCache
This method is used to gets the Object value from cache according to the given cache name and key.
-