All files / ima/cache CacheFactory.js

100% Statements 4/4
100% Branches 0/0
100% Functions 2/2
100% Lines 4/4
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28      3x             4x                       54x       3x  
import ns from '../namespace';
import CacheEntry from './CacheEntry';
 
ns.namespace('ima.cache');
 
/**
 * Factory for creating instances of {@linkcode CacheEntry}.
 */
export default class CacheFactory {
  static get $dependencies() {
    return [];
  }
 
  /**
	 * Create new instance of {@linkcode CacheEntry} with value a ttl.
	 *
	 * @param {*} value The cache entry value.
	 * @param {?number=} ttl Cache entry time to live in milliseconds. The
	 *        entry will expire after the specified amount of milliseconds.
	 * @return {CacheEntry} The created cache entry.
	 */
  createCacheEntry(value, ttl) {
    return new CacheEntry(value, ttl);
  }
}
 
ns.ima.cache.CacheFactory = CacheFactory;