-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
generating declaration files and renaming destination folder
- Loading branch information
Showing
12 changed files
with
99 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
export declare class LocalCache { | ||
private static cache; | ||
private constructor(); | ||
static InitiateInstance(): void; | ||
static get(key: string): any; | ||
static set(key: string, value: any, ttl?: number): void; | ||
static del(key: string): void; | ||
static getTtl(key: string): number | undefined; | ||
static recover(): void; | ||
private static createNodeCacheInstance; | ||
private static getTtlWithJitter; | ||
static flushAll(): Promise<void>; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as PersistentNodeCache } from "./persistentNodeCache"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,8 @@ | ||
"use strict"; | ||
// import { LocalCache } from "./cache"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PersistentNodeCache = void 0; | ||
// import { PersistentNodeCache } from "./persistentNodeCache"; | ||
// LocalCache.InitiateInstance(); | ||
// LocalCache.set("foo", "bar"); | ||
// LocalCache.set("cat", "dog"); | ||
// LocalCache.set("something", "nothing"); | ||
// LocalCache.recover(); | ||
// let val = LocalCache.get("foo") | ||
// console.log(val); | ||
var persistentNodeCache_1 = require("./persistentNodeCache"); | ||
Object.defineProperty(exports, "PersistentNodeCache", { enumerable: true, get: function () { return __importDefault(persistentNodeCache_1).default; } }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import NodeCache, { Key, ValueSetItem } from "node-cache"; | ||
export default class PersistentNodeCache extends NodeCache { | ||
private readonly interval; | ||
private readonly cacheName; | ||
private readonly emitter; | ||
private readonly backupFilePath; | ||
private readonly appendFilePath; | ||
private flushingToDisk; | ||
private appendFileDescriptor; | ||
constructor(cacheName: string, period?: number, dir?: string, opts?: any); | ||
set<T>(key: Key, value: T, ttl?: number | string): boolean; | ||
mset<T>(keyValueSet: ValueSetItem<T>[]): boolean; | ||
del(keys: Key | Key[]): number; | ||
take<T>(key: Key): T | undefined; | ||
ttl(key: Key, ttl?: number): boolean; | ||
flushAll(): void; | ||
close(): void; | ||
recover(): Promise<void>; | ||
private appendExpiredEvent; | ||
private saveToDisk; | ||
private appendToFile; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
export declare const waitFor: <Event_1 extends string>(event: Event_1, emitter: EventEmitter<Event_1>, callback?: Callback) => Promise<void>; | ||
export declare const removeListener: <Event_1 extends string>(emitter: EventEmitterOff<Event_1> | EventEmitterRemoveListener<Event_1>, event: "error" | Event_1, listener: EventListener) => void; | ||
interface Callback { | ||
(error: any): void; | ||
} | ||
interface EventListener { | ||
(...args: any[]): void; | ||
} | ||
interface EventEmitterOn<Event extends string> { | ||
on(event: Event | 'error', listener: EventListener): void; | ||
} | ||
interface EventEmitterOff<Event extends string> { | ||
off(event: Event | 'error', listener: EventListener): void; | ||
} | ||
interface EventEmitterAddListener<Event extends string> { | ||
addListener(event: Event | 'error', listener: EventListener): void; | ||
} | ||
interface EventEmitterRemoveListener<Event extends string> { | ||
removeListener(event: Event | 'error', listener: EventListener): void; | ||
} | ||
type EventEmitter<Event extends string> = (EventEmitterOn<Event> | EventEmitterAddListener<Event>) & (EventEmitterOff<Event> | EventEmitterRemoveListener<Event>); | ||
export {}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters