next-build-cache
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -12,3 +12,4 @@ interface CacheConfig { | ||
} | ||
export { Cache }; | ||
declare function accessCache<T>(filename: string, config?: Partial<CacheConfig>): Cache<T>; | ||
export { accessCache }; | ||
//# sourceMappingURL=cache.d.ts.map |
@@ -53,3 +53,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Cache = void 0; | ||
exports.accessCache = void 0; | ||
var fs_1 = __importDefault(require("fs")); | ||
@@ -146,3 +146,7 @@ var path_1 = __importDefault(require("path")); | ||
}()); | ||
exports.Cache = Cache; | ||
function accessCache(filename, config) { | ||
if (config === void 0) { config = {}; } | ||
return new Cache(filename, config); | ||
} | ||
exports.accessCache = accessCache; | ||
//# sourceMappingURL=cache.js.map |
@@ -1,2 +0,2 @@ | ||
export { Cache as default } from './cache'; | ||
export { accessCache } from './cache'; | ||
//# sourceMappingURL=index.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.default = void 0; | ||
exports.accessCache = void 0; | ||
var cache_1 = require("./cache"); | ||
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return cache_1.Cache; } }); | ||
Object.defineProperty(exports, "accessCache", { enumerable: true, get: function () { return cache_1.accessCache; } }); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "next-build-cache", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Ultra simple file system based caching built for the next.js build process.", | ||
@@ -13,5 +13,5 @@ "main": "lib/index.js", | ||
"cache", | ||
"file", | ||
"cache", | ||
"nextjs" | ||
"file-cache", | ||
"nextjs", | ||
"build-cache" | ||
], | ||
@@ -18,0 +18,0 @@ "author": "Erik Schake", |
@@ -26,12 +26,12 @@ # next-build-cache | ||
```javascript | ||
import Cache from 'next-build-cache'; | ||
import { accessCache } from 'next-build-cache'; | ||
// Create a new cache instance using the file 'build.cache' | ||
const BuildCache = new Cache('build.cache'); | ||
// Access the cache using the file 'build.cache' | ||
const cache = accessCache('build.cache'); | ||
// save a key-value pair with a specified time to live in ms | ||
BuildCache.put('mykey', 'myvalue', 1000); | ||
cache.put('mykey', 'myvalue', 1000); | ||
// get the value of a key | ||
BuildCache.get('mykey'); | ||
cache.get('mykey'); | ||
``` | ||
@@ -38,0 +38,0 @@ |
import fs from 'fs'; | ||
import path from 'path'; | ||
import { ModifierFlags } from 'typescript'; | ||
import { promisify } from 'util'; | ||
@@ -74,2 +73,6 @@ | ||
export { Cache }; | ||
function accessCache<T>(filename: string, config: Partial<CacheConfig> = {}) { | ||
return new Cache<T>(filename, config); | ||
} | ||
export { accessCache }; |
@@ -1,1 +0,1 @@ | ||
export { Cache as default } from './cache'; | ||
export { accessCache } from './cache'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
21044
297