Interface CacheProvider

  • All Known Implementing Classes:
    CacheProviderImpl

    public interface CacheProvider
    Since:
    6.0
    Author:
    kir
    • Method Detail

      • getOrCreateCache

        @NotNull
        <T extends SerializableSCache<T> getOrCreateCache​(String cacheName,
                                                            Class<T> cachedItemsClass)
        Create or get existing named disk-based cache. If new cache is created, the resulting cache data will be persisted to disk. The data is stored in the cache unlimited time.
      • getOrCreateCache

        @NotNull
        <T> SCache<T> getOrCreateCache​(String cacheName,
                                       Class<T> cachedItemsClass,
                                       int timeToLiveSeconds,
                                       boolean inMemoryOnly)
        Create or get existing named cache. NOTE: 'cachedItemsClass' should implement java.io.Serializable if 'inMemoryOnly' is false.
        Parameters:
        cacheName - cache name
        timeToLiveSeconds - time to live value for all values put to the cache (0 means eternal)
        inMemoryOnly - if true, cache will never be put on the disk
        Returns:
        cache object
      • getOrCreateCache

        @NotNull
        <T> SCache<T> getOrCreateCache​(String cacheName,
                                       Class<T> cachedItemsClass,
                                       int timeToLiveSeconds,
                                       int timeToIdleSeconds,
                                       boolean inMemoryOnly)
        Create or get existing named cache. NOTE: 'cachedItemsClass' should implement java.io.Serializable if 'inMemoryOnly' is false.
        Parameters:
        cacheName - cache name
        timeToLiveSeconds - time to live value for all values put to the cache (0 means eternal)
        timeToIdleSeconds - time to idle value for all values put to the cache (0 means eternal)
        inMemoryOnly - if true, cache will never be put on the disk
        Returns:
        cache object
        Since:
        2017.1
      • destroyCache

        boolean destroyCache​(@NotNull
                             String cacheName)
        Removes cache with specified name. For persistent caches removes cache data from disk as well.
        Parameters:
        cacheName - name of the cache
        Returns:
        true if cache destroyed, and false some error occurred and cache could not be destroyed