Interface CacheService

  • All Known Implementing Classes:
    AndroidCacheService, DefaultCacheService, DesktopCacheService, DummyCacheService, IOSCacheService

    public interface CacheService
    The cache service provides a simple API to weakly cache objects in memory. There is no guarantee that items being put in the cache will be retained for any minimum amount of time. They will be garbage collected when necessary.


     CacheService.create().ifPresent(service -> {
          Cache<String, String> cache = service.getCache("simpleCache");
          cache.put("key", "value");
          String value = cache.get("key");

    Android Configuration: none

    iOS Configuration: none

    • Method Detail

      • getCache

        <K,​V> Cache<K,​V> getCache​(java.lang.String cacheName)
        Returns a Cache instance. The name is used to allow for multiple cache instances to be created, with the name being a unique identifier, returning the same cache every time when given the same name.
        Type Parameters:
        K - The key type for the cache
        V - The value type for the cache
        cacheName - The name of the cache.
        A named Cache instance.