getCustomCache method

IwsCache getCustomCache({
  1. required String name,
  2. required bool persistent,
  3. int? maxSize,
  4. EvictionPolicy evictionPolicy = EvictionPolicy.lru,
  5. Duration cleanupInterval = const Duration(minutes: 30),
})

Get a custom cache instance with specific configuration

Implementation

IwsCache getCustomCache({
  required String name,
  required bool persistent,
  int? maxSize,
  EvictionPolicy evictionPolicy = EvictionPolicy.lru,
  Duration cleanupInterval = const Duration(minutes: 30),
}) {
  // You could store custom caches in a Map<String, IwsCache> if needed
  if (persistent) {
    return IwsPersistentCache(
      maxSize: maxSize,
      evictionPolicy: evictionPolicy,
      cleanupInterval: cleanupInterval,
    );
  } else {
    return IwsMemoryCache(
      maxSize: maxSize,
      evictionPolicy: evictionPolicy,
      cleanupInterval: cleanupInterval,
    );
  }
}