-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix cache error. * feat: augument type for fib-cache. --------- Co-authored-by: richardo2016 <[email protected]>
- Loading branch information
1 parent
a8a328b
commit a6884b0
Showing
8 changed files
with
108 additions
and
19 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
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,46 @@ | ||
const fibCache = require('fib-cache'); | ||
|
||
|
||
declare module "fib-cache" { | ||
interface LRUOptions { | ||
max?: number; | ||
ttl?: number; | ||
resolver?: (key: string) => any; | ||
} | ||
|
||
interface LRUItem { | ||
expiry: number; | ||
key: string; | ||
prev: LRUItem; | ||
next: LRUItem; | ||
owner: LRU; | ||
value: any; | ||
ready: Class_Event; | ||
} | ||
|
||
export class LRU { | ||
constructor(options?: LRUOptions); | ||
items: Record<string, LRUItem>; | ||
size: number; | ||
first: LRUItem; | ||
last: LRUItem; | ||
max: number; | ||
ttl: number; | ||
resolver: (key: string) => any; | ||
|
||
clear(): LRU; | ||
delete_item(item: LRUItem): LRU; | ||
delete(key: string): LRU; | ||
entries(keys?: string[]): [string, any][]; | ||
evict(): LRU; | ||
get(key: string): any; | ||
has(key: string): boolean; | ||
keys(): string[]; | ||
new_item(key: string, value?: any): LRUItem; | ||
order_item(item: LRUItem): void; | ||
set(key: string, value: any): LRU; | ||
values(keys?: string[]): any[]; | ||
} | ||
} | ||
|
||
module.exports = fibCache; |
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
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,40 @@ | ||
/// <reference types="@fibjs/types" /> | ||
declare const fibCache: any; | ||
declare module "fib-cache" { | ||
interface LRUOptions { | ||
max?: number; | ||
ttl?: number; | ||
resolver?: (key: string) => any; | ||
} | ||
interface LRUItem { | ||
expiry: number; | ||
key: string; | ||
prev: LRUItem; | ||
next: LRUItem; | ||
owner: LRU; | ||
value: any; | ||
ready: Class_Event; | ||
} | ||
class LRU { | ||
constructor(options?: LRUOptions); | ||
items: Record<string, LRUItem>; | ||
size: number; | ||
first: LRUItem; | ||
last: LRUItem; | ||
max: number; | ||
ttl: number; | ||
resolver: (key: string) => any; | ||
clear(): LRU; | ||
delete_item(item: LRUItem): LRU; | ||
delete(key: string): LRU; | ||
entries(keys?: string[]): [string, any][]; | ||
evict(): LRU; | ||
get(key: string): any; | ||
has(key: string): boolean; | ||
keys(): string[]; | ||
new_item(key: string, value?: any): LRUItem; | ||
order_item(item: LRUItem): void; | ||
set(key: string, value: any): LRU; | ||
values(keys?: string[]): any[]; | ||
} | ||
} |
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