Class CacheImpl

java.lang.Object
com.skava.service.impl.CacheImpl

@Service public class CacheImpl extends Object
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 Details

    • CacheImpl

      public CacheImpl()
      Default constructor.
  • Method Details

    • getCache

      public org.springframework.cache.Cache getCache(String cacheName)
      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

      public <P> Object covertObj(P value)
      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

      public <T> Object saveDetailsToCache(String cacheName, String cacheKey, T entity)
      This is user to save details in cache.
      Parameters:
      cacheName - Indicates the cache name. Instance of String object which is used for saving details in cache.
      cacheKey - Indicates the cache key. Instance of String object which is used for saving details in cache.
      entity - a CacheImpl object used for saving details in cache.
      Returns:
      A Object object.
    • deleteCacheWithKey

      public Object deleteCacheWithKey(String cacheName, String cacheKey)
      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

      public Object deleteCache(String cacheName)
      This is used to delete the cache with cache name.
      Parameters:
      cacheName - a String object used for deleting cache.
      Returns:
      A Object object.
    • clearCache

      public void clearCache(Set<String> cacheNames)
      This method is used to delete the cache by cache name.
      Parameters:
      cacheNames - indicates the cache names for clearing the cache.
    • getValueFromCache

      public Object getValueFromCache(String cacheName, String key)
      This method is used to gets the Object value from cache according to the given cache name and key.
      Parameters:
      cacheName - a String object which holds cache name for loading the cache.
      key - a String object which holds cache key for loading the cache.
      Returns:
      A Object object.