const lru = require('lru-cache');

module.exports = class LruCache {
  constructor({ maxItems }) {
    this.cache = lru(maxItems);
  }

  get(key) {
    return Promise.resolve(this.cache.get(key));
  }

  set(key, value, options) {
    const { maxAge } = options || {};
    this.cache.set(key, value, maxAge);
    return Promise.resolve(key);
  }

  values() {
    return Promise.resolve(this.cache.values());
  }

  length() {
    return this.cache.length;
  }
};

const lru = require('lru-cache');

module.exports = class LruCache {
  constructor(options) {
    const maxItems = options && options.maxItems
    this.cache = lru(maxItems);
  }

  get(key) {
    return Promise.resolve(this.cache.get(key));
  }

  set(key, value, options) {
    const { maxAge } = options || {};
    this.cache.set(key, value, maxAge);
    return Promise.resolve(key);
  }

  values() {
    return Promise.resolve(this.cache.values());
  }

  length() {
    return this.cache.length;
  }
};

Fix error if no argument is passed to constructor
Fix error if no argument is passed to constructor