Factory class for creating and managing different cache implementations. Provides registration and instantiation of cache types.

// Register a custom cache implementation
CacheFactory.register('redis', RedisCache);

// Create cache instances
const memoryCache = CacheFactory.create('memory', {
logPrefix: '[EntityCache]',
verbose: true
});
const redisCache = CacheFactory.create('redis', { namespace: 'embeddings' });

Constructors

Methods

  • Creates a new cache instance of the specified type.

    Type Parameters

    • T = any

      The type of values the cache will store

    Parameters

    Returns node.common.apis.cache.ICache<T>

    A new cache instance

    Error if the cache type is not registered

  • Returns a list of all registered cache implementation names.

    Returns string[]

    Array of available cache type names

  • Registers a new cache implementation with the factory.

    Type Parameters

    Parameters

    Returns void