UNPKG

cache-storage

Version:

[ABANDONED] Advanced cache storage for node js

48 lines (35 loc) 1.3 kB
// Generated by CoffeeScript 1.6.3 (function() { var MemoryStorage, Storage, _ref, __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; Storage = require('./Storage'); MemoryStorage = (function(_super) { __extends(MemoryStorage, _super); function MemoryStorage() { _ref = MemoryStorage.__super__.constructor.apply(this, arguments); return _ref; } MemoryStorage.prototype.data = null; MemoryStorage.prototype.meta = null; MemoryStorage.prototype.getData = function(fn) { if (this.data === null) { this.data = {}; } return fn(null, this.data); }; MemoryStorage.prototype.getMeta = function(fn) { if (this.meta === null) { this.meta = {}; } return fn(null, this.meta); }; MemoryStorage.prototype.writeData = function(data, meta, fn) { this.data = data; this.meta = meta; return fn(null); }; return MemoryStorage; })(Storage); module.exports = MemoryStorage; }).call(this);