Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.

public static final class Cache.Builder<K, V>

  1. Object
  2. Cache.Builder
A cache’s settings. Nothing is bounded or expires unless asked.

Methods

public Cache.Builder<K, V> maximumSize(long entries)At most entries entries.
public Cache.Builder<K, V> maximumWeight(long weight, Cache.Weigher<K, V> weigher)At most weight in total, as weigher weighs entries.
public Cache.Builder<K, V> expireAfterWriteMillis(long millis)Entries expire this long after they are stored.
public Cache.Builder<K, V> expireAfterAccessMillis(long millis)Entries expire this long after they were last read or stored.
public Cache.Builder<K, V> expiry(Cache.Expiry<K, V> expiry)Each entry’s lifetime from its write, chosen by expiry.
public Cache.Builder<K, V> removalListener(Cache.RemovalListener<K, V> listener)Told about every removal; see the class description.
public Cache.Builder<K, V> clock(Cache.Clock clock)The time source; the default is the monotonic system clock.
public Cache<K, V> build()

Inherited methods

Method details

maximumSize

public Cache.Builder<K, V> maximumSize(long entries)
At most entries entries. Excludes maximumWeight.

maximumWeight

public Cache.Builder<K, V> maximumWeight(long weight, Cache.Weigher<K, V> weigher)
At most weight in total, as weigher weighs entries. Excludes maximumSize.

expireAfterWriteMillis

public Cache.Builder<K, V> expireAfterWriteMillis(long millis)
Entries expire this long after they are stored.

expireAfterAccessMillis

public Cache.Builder<K, V> expireAfterAccessMillis(long millis)
Entries expire this long after they were last read or stored.

expiry

public Cache.Builder<K, V> expiry(Cache.Expiry<K, V> expiry)
Each entry’s lifetime from its write, chosen by expiry.

removalListener

public Cache.Builder<K, V> removalListener(Cache.RemovalListener<K, V> listener)
Told about every removal; see the class description.

clock

public Cache.Builder<K, V> clock(Cache.Clock clock)
The time source; the default is the monotonic system clock.

build

public Cache<K, V> build()