Class CaffeineProvider

java.lang.Object
io.github.xanthic.cache.core.AbstractCacheProvider
io.github.xanthic.cache.provider.caffeine.CaffeineProvider
All Implemented Interfaces:
io.github.xanthic.cache.api.CacheProvider

public final class CaffeineProvider extends io.github.xanthic.cache.core.AbstractCacheProvider
Provides Cache instances using Caffeine.

Implements size and time-based eviction.

For timely ICacheSpec.removalListener() calls, ICacheSpec.executor() should be specified.

This module depends on Caffeine version 2.x for Java 8 compatibility.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <K, V> io.github.xanthic.cache.api.Cache<K,V>
    build(io.github.xanthic.cache.api.ICacheSpec<K,V> spec)
     
    int
     

    Methods inherited from class io.github.xanthic.cache.core.AbstractCacheProvider

    getExpiryType, handleExpiration, handleUnsupportedExpiry, preferredType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CaffeineProvider

      public CaffeineProvider()
  • Method Details

    • build

      public <K, V> io.github.xanthic.cache.api.Cache<K,V> build(io.github.xanthic.cache.api.ICacheSpec<K,V> spec)
    • getDiscoveryOrder

      public int getDiscoveryOrder()
      Overrides:
      getDiscoveryOrder in class io.github.xanthic.cache.core.AbstractCacheProvider