@isdk/ai-tool 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/docs/README.md +0 -250
- package/docs/_media/CONTRIBUTING.md +0 -18
- package/docs/_media/LICENSE-MIT +0 -22
- package/docs/classes/AbortError.md +0 -366
- package/docs/classes/AlreadyExistsError.md +0 -346
- package/docs/classes/BaseError.md +0 -359
- package/docs/classes/BinarySemaphore.md +0 -418
- package/docs/classes/CancelableAbility.md +0 -467
- package/docs/classes/ClientTools.md +0 -2715
- package/docs/classes/CommonError.md +0 -377
- package/docs/classes/ConfigFile.md +0 -353
- package/docs/classes/EnvPromptTemplate.md +0 -1158
- package/docs/classes/EventClient.md +0 -3149
- package/docs/classes/EventEmitter.md +0 -299
- package/docs/classes/EventServer.md +0 -3175
- package/docs/classes/EventToolFunc.md +0 -2557
- package/docs/classes/FStringPromptTemplate.md +0 -1158
- package/docs/classes/FewShotPromptTemplate.md +0 -1180
- package/docs/classes/GolangPromptTemplate.md +0 -1158
- package/docs/classes/HFEnvironment.md +0 -184
- package/docs/classes/HFInterpreter.md +0 -77
- package/docs/classes/HFTemplate.md +0 -67
- package/docs/classes/HfPromptTemplate.md +0 -1158
- package/docs/classes/IntSet.md +0 -216
- package/docs/classes/LRUCache.md +0 -601
- package/docs/classes/NotFoundError.md +0 -346
- package/docs/classes/NotImplementationError.md +0 -346
- package/docs/classes/PromptExampleSelector.md +0 -195
- package/docs/classes/PromptTemplate.md +0 -1088
- package/docs/classes/ReadableStreamError.md +0 -366
- package/docs/classes/ResClientTools.md +0 -2431
- package/docs/classes/ResServerTools.md +0 -2407
- package/docs/classes/SSEChannel.md +0 -270
- package/docs/classes/Semaphore.md +0 -538
- package/docs/classes/ServerTools.md +0 -2623
- package/docs/classes/SignalGate.md +0 -182
- package/docs/classes/TaskAbortController.md +0 -131
- package/docs/classes/ToolFunc.md +0 -2177
- package/docs/classes/YamlTypeBaseObject.md +0 -31
- package/docs/enumerations/AsyncFeatureBits.md +0 -33
- package/docs/enumerations/AsyncFeatures.md +0 -33
- package/docs/enumerations/ErrorCode.md +0 -177
- package/docs/enumerations/HashAlgorithm.md +0 -97
- package/docs/functions/AIArgProcessor.md +0 -33
- package/docs/functions/AIStream.md +0 -52
- package/docs/functions/ChoiceArgProcessor.md +0 -33
- package/docs/functions/ObjectArgsToArgsInfo.md +0 -29
- package/docs/functions/RateLimit.md +0 -37
- package/docs/functions/TemplateArgProcessor.md +0 -33
- package/docs/functions/assignDirs.md +0 -33
- package/docs/functions/backendEventable.md +0 -29
- package/docs/functions/beforeShutdown.md +0 -29
- package/docs/functions/canonicalize.md +0 -21
- package/docs/functions/completeSentences.md +0 -25
- package/docs/functions/concatText.md +0 -25
- package/docs/functions/countLLMTokens.md +0 -25
- package/docs/functions/countRegexMatches.md +0 -35
- package/docs/functions/createAbilityInjector.md +0 -119
- package/docs/functions/createCallbacksTransformer.md +0 -49
- package/docs/functions/createEmptyReadableStream.md +0 -21
- package/docs/functions/createEndWithRepetitionDetector.md +0 -31
- package/docs/functions/createError.md +0 -39
- package/docs/functions/createEventStreamTransformer.md +0 -33
- package/docs/functions/createHfValueFunc.md +0 -31
- package/docs/functions/createLRUCache.md +0 -25
- package/docs/functions/createYamlObjectTag.md +0 -25
- package/docs/functions/dateToText.md +0 -25
- package/docs/functions/decodeCharset.md +0 -25
- package/docs/functions/detectCharset.md +0 -25
- package/docs/functions/encodeLLMTokens.md +0 -25
- package/docs/functions/ensureQuoted.md +0 -25
- package/docs/functions/eventable.md +0 -82
- package/docs/functions/expandConfig.md +0 -25
- package/docs/functions/expandEnv.md +0 -40
- package/docs/functions/expandObjEnv.md +0 -58
- package/docs/functions/expandPath.md +0 -25
- package/docs/functions/extNameLevel.md +0 -43
- package/docs/functions/fileIsExists.md +0 -34
- package/docs/functions/filenameReservedRegex.md +0 -20
- package/docs/functions/filterValidFnScope.md +0 -21
- package/docs/functions/findIndexNonEmptyFrom.md +0 -25
- package/docs/functions/findPort.md +0 -25
- package/docs/functions/formatISO.md +0 -69
- package/docs/functions/formatTextWithSpace.md +0 -63
- package/docs/functions/getAllEnumKeys.md +0 -31
- package/docs/functions/getConfigFileNames.md +0 -25
- package/docs/functions/getConfigs.md +0 -25
- package/docs/functions/getEnvVairables.md +0 -21
- package/docs/functions/getFileMetaInfo.md +0 -21
- package/docs/functions/getHashAlgoBySize.md +0 -21
- package/docs/functions/getKeysPath.md +0 -38
- package/docs/functions/getLLMTokenizer.md +0 -21
- package/docs/functions/getMultiLevelExtname.md +0 -33
- package/docs/functions/getPackageDir.md +0 -39
- package/docs/functions/getRealFilepath.md +0 -34
- package/docs/functions/getResponseErrorReadableStream.md +0 -21
- package/docs/functions/getXDGConfigs.md +0 -37
- package/docs/functions/hasDirectoryIn.md +0 -40
- package/docs/functions/hash.md +0 -25
- package/docs/functions/hashFile.md +0 -25
- package/docs/functions/hashStream.md +0 -25
- package/docs/functions/hfParse.md +0 -24
- package/docs/functions/hfTokenize.md +0 -27
- package/docs/functions/initShutdown.md +0 -15
- package/docs/functions/interpolateEnv.md +0 -29
- package/docs/functions/interpolateFString.md +0 -29
- package/docs/functions/interpolateGolangTemplate.md +0 -35
- package/docs/functions/isLangUsingSpaces.md +0 -21
- package/docs/functions/isListItemString.md +0 -21
- package/docs/functions/isModelNameMatched.md +0 -47
- package/docs/functions/isPunctuationChar.md +0 -36
- package/docs/functions/isQuoted.md +0 -21
- package/docs/functions/isRegExp.md +0 -21
- package/docs/functions/isSameString.md +0 -36
- package/docs/functions/isSectionString.md +0 -25
- package/docs/functions/isSentenceEnding.md +0 -21
- package/docs/functions/isSepLineString.md +0 -21
- package/docs/functions/isStrWrapped.md +0 -25
- package/docs/functions/isSubdirectory.md +0 -41
- package/docs/functions/isTitleString.md +0 -25
- package/docs/functions/isValidFilename.md +0 -38
- package/docs/functions/isValidFilepath.md +0 -27
- package/docs/functions/isWebStream.md +0 -21
- package/docs/functions/jsonFilterToWhere.md +0 -47
- package/docs/functions/jsonToMarkdownStr.md +0 -39
- package/docs/functions/loadAIConfig.md +0 -21
- package/docs/functions/loadConfig.md +0 -25
- package/docs/functions/loadConfigFile.md +0 -25
- package/docs/functions/loadFileFromPaths.md +0 -64
- package/docs/functions/loadTextFromPaths.md +0 -37
- package/docs/functions/lrucache.md +0 -35
- package/docs/functions/makeToolFuncCancelable.md +0 -29
- package/docs/functions/matchUrlProtocol.md +0 -48
- package/docs/functions/memoize.md +0 -29
- package/docs/functions/messagesToText.md +0 -21
- package/docs/functions/paramsSizeToScaleStr.md +0 -34
- package/docs/functions/parseCommand.md +0 -29
- package/docs/functions/parseDateFormat.md +0 -362
- package/docs/functions/parseFString.md +0 -26
- package/docs/functions/parseISO.md +0 -70
- package/docs/functions/parseJsJson.md +0 -40
- package/docs/functions/parseJsJsonSimpleSync.md +0 -25
- package/docs/functions/parseObjectArgInfo.md +0 -33
- package/docs/functions/parseObjectArgumentInfos.md +0 -29
- package/docs/functions/parseObjectArguments.md +0 -72
- package/docs/functions/parseObjectArgumentsAsArgInfos.md +0 -46
- package/docs/functions/parseYaml.md +0 -25
- package/docs/functions/quoteStr.md +0 -21
- package/docs/functions/reControlCharsRegex.md +0 -19
- package/docs/functions/readFilenamesRecursiveSync.md +0 -53
- package/docs/functions/readTextFileChunks.md +0 -53
- package/docs/functions/readTextFileChunksEx.md +0 -25
- package/docs/functions/readableFromAsyncIterable.md +0 -28
- package/docs/functions/registerCoreTools.md +0 -15
- package/docs/functions/registerYamlTag.md +0 -21
- package/docs/functions/removeMarkdownBold.md +0 -25
- package/docs/functions/removeMarkdownBoldAndItalic.md +0 -25
- package/docs/functions/removeMarkdownItalic.md +0 -25
- package/docs/functions/replaceWithPlaceholder.md +0 -43
- package/docs/functions/restoreFromPlacehoders.md +0 -49
- package/docs/functions/sanitizeFilename.md +0 -39
- package/docs/functions/sanitizeFilepath.md +0 -33
- package/docs/functions/saveConfigFile.md +0 -29
- package/docs/functions/scaleStrToParamsSize.md +0 -27
- package/docs/functions/shutdown.md +0 -33
- package/docs/functions/simplifyObjectArguments.md +0 -21
- package/docs/functions/sortedValues.md +0 -25
- package/docs/functions/splitChunks.md +0 -25
- package/docs/functions/splitParagraph.md +0 -34
- package/docs/functions/splitSentence.md +0 -39
- package/docs/functions/stringifyYaml.md +0 -25
- package/docs/functions/stripConsoleColor.md +0 -21
- package/docs/functions/textToDate.md +0 -25
- package/docs/functions/throwError.md +0 -41
- package/docs/functions/toDate.md +0 -74
- package/docs/functions/toDateTime.md +0 -21
- package/docs/functions/toRegExp.md +0 -34
- package/docs/functions/trimStartOfStreamHelper.md +0 -41
- package/docs/functions/truncTo.md +0 -51
- package/docs/functions/truncateByToken.md +0 -25
- package/docs/functions/truncateToTokenLimit.md +0 -46
- package/docs/functions/truncateToTokenLimitEx.md +0 -25
- package/docs/functions/uuid.md +0 -25
- package/docs/functions/uuidParse.md +0 -21
- package/docs/functions/uuidStringify.md +0 -25
- package/docs/functions/uuidValidate.md +0 -21
- package/docs/functions/uuidVersion.md +0 -21
- package/docs/functions/uuidv1.md +0 -55
- package/docs/functions/uuidv4.md +0 -55
- package/docs/functions/uuidv5.md +0 -63
- package/docs/functions/wait.md +0 -21
- package/docs/functions/wrapEventEmitter.md +0 -27
- package/docs/functions/xxhash.md +0 -29
- package/docs/functions/xxhash32.md +0 -25
- package/docs/functions/xxhash64.md +0 -25
- package/docs/functions/xxhashAsStr.md +0 -29
- package/docs/globals.md +0 -329
- package/docs/interfaces/AIChatAssistantMessageParam.md +0 -129
- package/docs/interfaces/AIChatContentPartImage.md +0 -29
- package/docs/interfaces/AIChatContentPartText.md +0 -25
- package/docs/interfaces/AIChatMessageParamBase.md +0 -68
- package/docs/interfaces/AIChatMessageToolCall.md +0 -41
- package/docs/interfaces/AIChatSystemMessageParam.md +0 -105
- package/docs/interfaces/AIChatToolChoiceFuncObject.md +0 -37
- package/docs/interfaces/AIChatToolChoiceObject.md +0 -25
- package/docs/interfaces/AIChatToolFunc.md +0 -41
- package/docs/interfaces/AIChatToolFuncParam.md +0 -37
- package/docs/interfaces/AIChatToolMessageParam.md +0 -113
- package/docs/interfaces/AIChatToolParam.md +0 -25
- package/docs/interfaces/AIChatToolTypeObject.md +0 -17
- package/docs/interfaces/AIChatUserMessageParam.md +0 -137
- package/docs/interfaces/AIChoiceConfig.md +0 -65
- package/docs/interfaces/AIResult.md +0 -65
- package/docs/interfaces/AIStreamParser.md +0 -43
- package/docs/interfaces/AIStreamParserOptions.md +0 -21
- package/docs/interfaces/BaseFunc.md +0 -145
- package/docs/interfaces/BaseFuncItem.md +0 -93
- package/docs/interfaces/BinarySemaphoreAcquireOptions.md +0 -25
- package/docs/interfaces/BinarySemaphoreOptions.md +0 -57
- package/docs/interfaces/BinarySemaphoreReleaseOptions.md +0 -25
- package/docs/interfaces/BinarySemaphoreReleaserFunc.md +0 -37
- package/docs/interfaces/CancelableAbilityOptions.md +0 -113
- package/docs/interfaces/ClientFuncItem.md +0 -163
- package/docs/interfaces/DotenvExpandOptions.md +0 -43
- package/docs/interfaces/DotenvExpandOutput.md +0 -25
- package/docs/interfaces/DotenvParseInput.md +0 -13
- package/docs/interfaces/DotenvParseOutput.md +0 -13
- package/docs/interfaces/DotenvPopulateInput.md +0 -13
- package/docs/interfaces/EventClientFuncParams.md +0 -51
- package/docs/interfaces/EventServerFuncParams.md +0 -67
- package/docs/interfaces/FewShotPromptTemplateOptions.md +0 -147
- package/docs/interfaces/FuncItem.md +0 -131
- package/docs/interfaces/FuncParam.md +0 -61
- package/docs/interfaces/FuncParams.md +0 -13
- package/docs/interfaces/Funcs.md +0 -13
- package/docs/interfaces/HashAlgoParams.md +0 -33
- package/docs/interfaces/IFileMetaInfo.md +0 -65
- package/docs/interfaces/IReadTextFileChunksOptions.md +0 -143
- package/docs/interfaces/ITruncateToTokenLimitOptions.md +0 -99
- package/docs/interfaces/JsonFilter.md +0 -13
- package/docs/interfaces/ParseObjectArgumentOptions.md +0 -89
- package/docs/interfaces/PromptExampleSelectorOptions.md +0 -34
- package/docs/interfaces/PromptTemplateOptions.md +0 -65
- package/docs/interfaces/RemoteFuncItem.md +0 -152
- package/docs/interfaces/ReplacePlacehoderOptions.md +0 -41
- package/docs/interfaces/ResClientFuncParams.md +0 -37
- package/docs/interfaces/ResServerFuncParams.md +0 -69
- package/docs/interfaces/SanitizeFilenameOptions.md +0 -25
- package/docs/interfaces/SectionStringOptions.md +0 -25
- package/docs/interfaces/SemaphoreOptions.md +0 -89
- package/docs/interfaces/SemaphoreTaskItem.md +0 -73
- package/docs/interfaces/ServerFuncItem.md +0 -171
- package/docs/interfaces/ServerFuncParams.md +0 -35
- package/docs/interfaces/SplitSentenceOptions.md +0 -41
- package/docs/interfaces/StreamCallbacksAndOptions.md +0 -99
- package/docs/interfaces/TaskAbortControllers.md +0 -13
- package/docs/interfaces/TaskPromise.md +0 -138
- package/docs/interfaces/ToolFuncPackage.md +0 -47
- package/docs/namespaces/EventStates/README.md +0 -14
- package/docs/namespaces/EventStates/variables/ABORT.md +0 -11
- package/docs/namespaces/EventStates/variables/CONTINUE.md +0 -11
- package/docs/namespaces/EventStates/variables/DONE.md +0 -11
- package/docs/namespaces/EventStates/variables/STOPPED.md +0 -11
- package/docs/namespaces/uuidv5/README.md +0 -12
- package/docs/namespaces/uuidv5/variables/DNS.md +0 -11
- package/docs/namespaces/uuidv5/variables/URL.md +0 -11
- package/docs/type-aliases/AIChatContentPart.md +0 -11
- package/docs/type-aliases/AIChatMessageParam.md +0 -11
- package/docs/type-aliases/AIChatRole.md +0 -11
- package/docs/type-aliases/AIChatToolChoiceParam.md +0 -11
- package/docs/type-aliases/AIMessageType.md +0 -11
- package/docs/type-aliases/AIModelNameRule.md +0 -11
- package/docs/type-aliases/AIModelNameRuleFn.md +0 -21
- package/docs/type-aliases/AIModelNameRules.md +0 -11
- package/docs/type-aliases/AITextGenerationFinishReason.md +0 -11
- package/docs/type-aliases/ActionName.md +0 -11
- package/docs/type-aliases/AsyncTaskId.md +0 -11
- package/docs/type-aliases/BeforeShutdownListener.md +0 -23
- package/docs/type-aliases/EventErrorListenerFn.md +0 -33
- package/docs/type-aliases/EventListenerFn.md +0 -29
- package/docs/type-aliases/FStringPromptTemplateNode.md +0 -14
- package/docs/type-aliases/FuncParamType.md +0 -11
- package/docs/type-aliases/PromptExamples.md +0 -15
- package/docs/type-aliases/PromptTemplateType.md +0 -11
- package/docs/type-aliases/PromptType.md +0 -11
- package/docs/type-aliases/SemaphoreIsReadyFuncType.md +0 -15
- package/docs/type-aliases/TFunc.md +0 -25
- package/docs/variables/AIChatRoles.md +0 -11
- package/docs/variables/AIMessageTypes.md +0 -11
- package/docs/variables/AITextGenerationFinishReasons.md +0 -11
- package/docs/variables/AbortErrorCode.md +0 -11
- package/docs/variables/ActionNames.md +0 -11
- package/docs/variables/AlreadyExistsErrorCode.md +0 -11
- package/docs/variables/ClientToolFuncSchema.md +0 -101
- package/docs/variables/DEFAULT_CONFIG_NAME.md +0 -11
- package/docs/variables/DefaultAsyncSemaphoreCapacity.md +0 -11
- package/docs/variables/EventBusName.md +0 -11
- package/docs/variables/EventName.md +0 -11
- package/docs/variables/FilenameReservedRegex.md +0 -14
- package/docs/variables/HFBuiltins.md +0 -122
- package/docs/variables/InternalErrorCode.md +0 -11
- package/docs/variables/LLM_TOKENIZER_NAMES.md +0 -81
- package/docs/variables/LLM_TOKENIZER_NAMES_MAP.md +0 -11
- package/docs/variables/NotFoundErrorCode.md +0 -11
- package/docs/variables/NotImplementedErrorCode.md +0 -11
- package/docs/variables/PASSING_SCORE.md +0 -11
- package/docs/variables/PromptTemplateTypes.md +0 -11
- package/docs/variables/PromptTypes.md +0 -14
- package/docs/variables/RStreamErrCode.md +0 -11
- package/docs/variables/RemoteToolFuncSchema.md +0 -101
- package/docs/variables/ResponseRStreamErrCode.md +0 -11
- package/docs/variables/SHUTDOWN_SIGNALS.md +0 -17
- package/docs/variables/SSEChannelAlreadyClosedErrCode.md +0 -11
- package/docs/variables/SecondaryCache.md +0 -11
- package/docs/variables/ServerToolFuncSchema.md +0 -101
- package/docs/variables/ToolAsyncCancelableBit.md +0 -11
- package/docs/variables/ToolAsyncMultiTaskBit.md +0 -11
- package/docs/variables/ToolAsyncPriorityBit.md +0 -11
- package/docs/variables/ToolFuncSchema.md +0 -133
- package/docs/variables/WindowsReservedNameRegex.md +0 -13
- package/docs/variables/base32768.md +0 -11
- package/docs/variables/defaultTemplateFormat.md +0 -11
- package/docs/variables/event.md +0 -11
- package/docs/variables/eventClient.md +0 -11
- package/docs/variables/eventServer.md +0 -11
- package/docs/variables/lrucache.md +0 -11
- package/docs/variables/mimeType.md +0 -11
- package/docs/variables/uuidNIL.md +0 -11
package/docs/classes/LRUCache.md
DELETED
|
@@ -1,601 +0,0 @@
|
|
|
1
|
-
[**@isdk/ai-tool**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@isdk/ai-tool](../globals.md) / LRUCache
|
|
6
|
-
|
|
7
|
-
# Class: LRUCache
|
|
8
|
-
|
|
9
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:40
|
|
10
|
-
|
|
11
|
-
Least Recently Used (LRU) Cache.
|
|
12
|
-
|
|
13
|
-
## Example
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
const cache = new LRUCache({
|
|
17
|
-
capacity: 100,
|
|
18
|
-
expires: 30000, // 30 seconds
|
|
19
|
-
cleanInterval: 60 // 1 minute
|
|
20
|
-
});
|
|
21
|
-
cache.set('key1', 'value1', 5000); // add an item with expiration time of 5 seconds
|
|
22
|
-
cache.set('key2', 'value2'); // add an item with default expiration time
|
|
23
|
-
cache.get('key1'); // returns 'value1'
|
|
24
|
-
cache.forEach((value, key, cache) => console.log(key, value)); // iterates over each item in the cache
|
|
25
|
-
cache.delete('key1'); // removes the item with key 'key1'
|
|
26
|
-
cache.clear(); // removes all items from the cache
|
|
27
|
-
cache.free(); // frees up the memory used by the cache
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Constructors
|
|
31
|
-
|
|
32
|
-
### new LRUCache()
|
|
33
|
-
|
|
34
|
-
> **new LRUCache**(`options`?): [`LRUCache`](LRUCache.md)
|
|
35
|
-
|
|
36
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:69
|
|
37
|
-
|
|
38
|
-
Represents a Least Recently Used (LRU) Cache.
|
|
39
|
-
|
|
40
|
-
#### Parameters
|
|
41
|
-
|
|
42
|
-
##### options?
|
|
43
|
-
|
|
44
|
-
Optional the configuration options object for the cache or the max capacity number.
|
|
45
|
-
|
|
46
|
-
`number` | `ILRUCacheOptions`
|
|
47
|
-
|
|
48
|
-
#### Returns
|
|
49
|
-
|
|
50
|
-
[`LRUCache`](LRUCache.md)
|
|
51
|
-
|
|
52
|
-
#### Example
|
|
53
|
-
|
|
54
|
-
```ts
|
|
55
|
-
const cache = new LRUCache({
|
|
56
|
-
capacity: 100,
|
|
57
|
-
expires: 30000, // 30 seconds
|
|
58
|
-
cleanInterval: 60 // 1 minute
|
|
59
|
-
});
|
|
60
|
-
cache.set('key1', 'value1', 5000); // add an item with expiration time of 5 seconds
|
|
61
|
-
cache.set('key2', 'value2'); // add an item with default expiration time
|
|
62
|
-
cache.get('key1'); // returns 'value1'
|
|
63
|
-
cache.forEach((value, key, cache) => console.log(key, value)); // iterates over each item in the cache
|
|
64
|
-
cache.delete('key1'); // removes the item with key 'key1'
|
|
65
|
-
cache.clear(); // removes all items from the cache
|
|
66
|
-
cache.free(); // frees up the memory used by the cache
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Properties
|
|
70
|
-
|
|
71
|
-
### \_cacheLRU
|
|
72
|
-
|
|
73
|
-
> **\_cacheLRU**: `Object`
|
|
74
|
-
|
|
75
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:45
|
|
76
|
-
|
|
77
|
-
***
|
|
78
|
-
|
|
79
|
-
### \_lruQueue
|
|
80
|
-
|
|
81
|
-
> **\_lruQueue**: `LRUQueue`
|
|
82
|
-
|
|
83
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:46
|
|
84
|
-
|
|
85
|
-
***
|
|
86
|
-
|
|
87
|
-
### cleanInterval
|
|
88
|
-
|
|
89
|
-
> **cleanInterval**: `number`
|
|
90
|
-
|
|
91
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:43
|
|
92
|
-
|
|
93
|
-
***
|
|
94
|
-
|
|
95
|
-
### maxAge
|
|
96
|
-
|
|
97
|
-
> **maxAge**: `number`
|
|
98
|
-
|
|
99
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:42
|
|
100
|
-
|
|
101
|
-
***
|
|
102
|
-
|
|
103
|
-
### maxCapacity
|
|
104
|
-
|
|
105
|
-
> **maxCapacity**: `number`
|
|
106
|
-
|
|
107
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:41
|
|
108
|
-
|
|
109
|
-
## Methods
|
|
110
|
-
|
|
111
|
-
### clear()
|
|
112
|
-
|
|
113
|
-
> **clear**(): [`LRUCache`](LRUCache.md)
|
|
114
|
-
|
|
115
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:154
|
|
116
|
-
|
|
117
|
-
Deletes all items from the cache.
|
|
118
|
-
|
|
119
|
-
#### Returns
|
|
120
|
-
|
|
121
|
-
[`LRUCache`](LRUCache.md)
|
|
122
|
-
|
|
123
|
-
- Returns the cache instance.
|
|
124
|
-
|
|
125
|
-
#### Example
|
|
126
|
-
|
|
127
|
-
```ts
|
|
128
|
-
cache.clear(); // removes all items from the cache
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
***
|
|
132
|
-
|
|
133
|
-
### clearExpires()
|
|
134
|
-
|
|
135
|
-
> **clearExpires**(): `any`
|
|
136
|
-
|
|
137
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:180
|
|
138
|
-
|
|
139
|
-
Deletes all expires items from the cache.
|
|
140
|
-
|
|
141
|
-
#### Returns
|
|
142
|
-
|
|
143
|
-
`any`
|
|
144
|
-
|
|
145
|
-
- Returns the cache instance.
|
|
146
|
-
|
|
147
|
-
#### Example
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
cache.clearExpires(); // removes all expires items from the cache
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
***
|
|
154
|
-
|
|
155
|
-
### del()
|
|
156
|
-
|
|
157
|
-
> **del**(`id`, `isInternal`?): `boolean`
|
|
158
|
-
|
|
159
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:110
|
|
160
|
-
|
|
161
|
-
Alias for `delete()`.
|
|
162
|
-
|
|
163
|
-
#### Parameters
|
|
164
|
-
|
|
165
|
-
##### id
|
|
166
|
-
|
|
167
|
-
`any`
|
|
168
|
-
|
|
169
|
-
The key of the item to delete.
|
|
170
|
-
|
|
171
|
-
##### isInternal?
|
|
172
|
-
|
|
173
|
-
`boolean`
|
|
174
|
-
|
|
175
|
-
Indicates whether the function is called internally.
|
|
176
|
-
|
|
177
|
-
#### Returns
|
|
178
|
-
|
|
179
|
-
`boolean`
|
|
180
|
-
|
|
181
|
-
- Returns `true` if the item was deleted, or `false` if the item was not found in the cache.
|
|
182
|
-
|
|
183
|
-
#### Example
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
cache.del('key1'); // removes the item with key 'key1'
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
***
|
|
190
|
-
|
|
191
|
-
### delete()
|
|
192
|
-
|
|
193
|
-
> **delete**(`id`, `isInternal`?): `boolean`
|
|
194
|
-
|
|
195
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:100
|
|
196
|
-
|
|
197
|
-
Deletes an item from the cache.
|
|
198
|
-
|
|
199
|
-
#### Parameters
|
|
200
|
-
|
|
201
|
-
##### id
|
|
202
|
-
|
|
203
|
-
`any`
|
|
204
|
-
|
|
205
|
-
The key of the item to delete.
|
|
206
|
-
|
|
207
|
-
##### isInternal?
|
|
208
|
-
|
|
209
|
-
`boolean`
|
|
210
|
-
|
|
211
|
-
Indicates whether the function is called internally.
|
|
212
|
-
|
|
213
|
-
#### Returns
|
|
214
|
-
|
|
215
|
-
`boolean`
|
|
216
|
-
|
|
217
|
-
- Returns `true` if the item was deleted, or `false` if the item was not found in the cache.
|
|
218
|
-
|
|
219
|
-
#### Example
|
|
220
|
-
|
|
221
|
-
```ts
|
|
222
|
-
cache.delete('key1'); // removes the item with key 'key1'
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
***
|
|
226
|
-
|
|
227
|
-
### delListener()
|
|
228
|
-
|
|
229
|
-
> **delListener**(`type`, `listener`): [`LRUCache`](LRUCache.md)
|
|
230
|
-
|
|
231
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:70
|
|
232
|
-
|
|
233
|
-
#### Parameters
|
|
234
|
-
|
|
235
|
-
##### type
|
|
236
|
-
|
|
237
|
-
`string`
|
|
238
|
-
|
|
239
|
-
##### listener
|
|
240
|
-
|
|
241
|
-
`Function`
|
|
242
|
-
|
|
243
|
-
#### Returns
|
|
244
|
-
|
|
245
|
-
[`LRUCache`](LRUCache.md)
|
|
246
|
-
|
|
247
|
-
***
|
|
248
|
-
|
|
249
|
-
### forEach()
|
|
250
|
-
|
|
251
|
-
> **forEach**(`callback`, `thisArg`?): `void`
|
|
252
|
-
|
|
253
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:172
|
|
254
|
-
|
|
255
|
-
Iterates over each item in the cache and calls a function for each item.
|
|
256
|
-
|
|
257
|
-
#### Parameters
|
|
258
|
-
|
|
259
|
-
##### callback
|
|
260
|
-
|
|
261
|
-
(`value`, `id`, `thisArg`) => `void`
|
|
262
|
-
|
|
263
|
-
The function to call for each item. The function should accept three arguments: `value`, `id`, and `this`.
|
|
264
|
-
|
|
265
|
-
##### thisArg?
|
|
266
|
-
|
|
267
|
-
`any`
|
|
268
|
-
|
|
269
|
-
The `this` value to use when calling the function.
|
|
270
|
-
|
|
271
|
-
#### Returns
|
|
272
|
-
|
|
273
|
-
`void`
|
|
274
|
-
|
|
275
|
-
#### Example
|
|
276
|
-
|
|
277
|
-
```ts
|
|
278
|
-
cache.forEach((value, key, cache) => console.log(key, value));
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
***
|
|
282
|
-
|
|
283
|
-
### free()
|
|
284
|
-
|
|
285
|
-
> **free**(): `any`
|
|
286
|
-
|
|
287
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:163
|
|
288
|
-
|
|
289
|
-
Frees up the memory used by the cache.
|
|
290
|
-
|
|
291
|
-
#### Returns
|
|
292
|
-
|
|
293
|
-
`any`
|
|
294
|
-
|
|
295
|
-
- Returns the timestamp of the last cleanup operation.
|
|
296
|
-
|
|
297
|
-
#### Example
|
|
298
|
-
|
|
299
|
-
```ts
|
|
300
|
-
cache.free(); // frees up the memory used by the cache
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
***
|
|
304
|
-
|
|
305
|
-
### get()
|
|
306
|
-
|
|
307
|
-
> **get**(`id`): `any`
|
|
308
|
-
|
|
309
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:134
|
|
310
|
-
|
|
311
|
-
Returns the value of an item in the cache and updates its last-used time.
|
|
312
|
-
|
|
313
|
-
#### Parameters
|
|
314
|
-
|
|
315
|
-
##### id
|
|
316
|
-
|
|
317
|
-
`any`
|
|
318
|
-
|
|
319
|
-
The key of the item to retrieve.
|
|
320
|
-
|
|
321
|
-
#### Returns
|
|
322
|
-
|
|
323
|
-
`any`
|
|
324
|
-
|
|
325
|
-
- Returns the value of the item, or `undefined` if the item was not found in the cache or has expired.
|
|
326
|
-
|
|
327
|
-
#### Example
|
|
328
|
-
|
|
329
|
-
```ts
|
|
330
|
-
const value = cache.get('key1');
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
***
|
|
334
|
-
|
|
335
|
-
### has()
|
|
336
|
-
|
|
337
|
-
> **has**(`id`): `boolean`
|
|
338
|
-
|
|
339
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:80
|
|
340
|
-
|
|
341
|
-
Checks whether an item exists in the cache.
|
|
342
|
-
|
|
343
|
-
#### Parameters
|
|
344
|
-
|
|
345
|
-
##### id
|
|
346
|
-
|
|
347
|
-
`any`
|
|
348
|
-
|
|
349
|
-
the id to check
|
|
350
|
-
|
|
351
|
-
#### Returns
|
|
352
|
-
|
|
353
|
-
`boolean`
|
|
354
|
-
|
|
355
|
-
- True if the item exists in the cache, false otherwise.
|
|
356
|
-
|
|
357
|
-
#### Example
|
|
358
|
-
|
|
359
|
-
```ts
|
|
360
|
-
const exists = cache.has("someItem");
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
***
|
|
364
|
-
|
|
365
|
-
### isExist()
|
|
366
|
-
|
|
367
|
-
> **isExist**(`id`): `boolean`
|
|
368
|
-
|
|
369
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:85
|
|
370
|
-
|
|
371
|
-
Wether the id is in the cache
|
|
372
|
-
|
|
373
|
-
#### Parameters
|
|
374
|
-
|
|
375
|
-
##### id
|
|
376
|
-
|
|
377
|
-
`any`
|
|
378
|
-
|
|
379
|
-
the id to check
|
|
380
|
-
|
|
381
|
-
#### Returns
|
|
382
|
-
|
|
383
|
-
`boolean`
|
|
384
|
-
|
|
385
|
-
***
|
|
386
|
-
|
|
387
|
-
### isExists()
|
|
388
|
-
|
|
389
|
-
> **isExists**(`id`): `boolean`
|
|
390
|
-
|
|
391
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:90
|
|
392
|
-
|
|
393
|
-
Wether the id is in the cache
|
|
394
|
-
|
|
395
|
-
#### Parameters
|
|
396
|
-
|
|
397
|
-
##### id
|
|
398
|
-
|
|
399
|
-
`any`
|
|
400
|
-
|
|
401
|
-
the id to check
|
|
402
|
-
|
|
403
|
-
#### Returns
|
|
404
|
-
|
|
405
|
-
`boolean`
|
|
406
|
-
|
|
407
|
-
***
|
|
408
|
-
|
|
409
|
-
### isExpired()
|
|
410
|
-
|
|
411
|
-
> **isExpired**(`item`): `boolean`
|
|
412
|
-
|
|
413
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:116
|
|
414
|
-
|
|
415
|
-
Check the item whether already expired, the item will be removed from the cache if expired
|
|
416
|
-
|
|
417
|
-
#### Parameters
|
|
418
|
-
|
|
419
|
-
##### item
|
|
420
|
-
|
|
421
|
-
`LRUCacheItem`
|
|
422
|
-
|
|
423
|
-
the item to check
|
|
424
|
-
|
|
425
|
-
#### Returns
|
|
426
|
-
|
|
427
|
-
`boolean`
|
|
428
|
-
|
|
429
|
-
***
|
|
430
|
-
|
|
431
|
-
### length()
|
|
432
|
-
|
|
433
|
-
> **length**(): `number`
|
|
434
|
-
|
|
435
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:192
|
|
436
|
-
|
|
437
|
-
Get the number of items in the cache.
|
|
438
|
-
|
|
439
|
-
#### Returns
|
|
440
|
-
|
|
441
|
-
`number`
|
|
442
|
-
|
|
443
|
-
The number of items in the LRUCache.
|
|
444
|
-
|
|
445
|
-
***
|
|
446
|
-
|
|
447
|
-
### off()
|
|
448
|
-
|
|
449
|
-
> **off**(`type`, `listener`): [`LRUCache`](LRUCache.md)
|
|
450
|
-
|
|
451
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:72
|
|
452
|
-
|
|
453
|
-
#### Parameters
|
|
454
|
-
|
|
455
|
-
##### type
|
|
456
|
-
|
|
457
|
-
`string`
|
|
458
|
-
|
|
459
|
-
##### listener
|
|
460
|
-
|
|
461
|
-
`Function`
|
|
462
|
-
|
|
463
|
-
#### Returns
|
|
464
|
-
|
|
465
|
-
[`LRUCache`](LRUCache.md)
|
|
466
|
-
|
|
467
|
-
***
|
|
468
|
-
|
|
469
|
-
### on()
|
|
470
|
-
|
|
471
|
-
> **on**(`type`, `listener`): [`LRUCache`](LRUCache.md)
|
|
472
|
-
|
|
473
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:71
|
|
474
|
-
|
|
475
|
-
#### Parameters
|
|
476
|
-
|
|
477
|
-
##### type
|
|
478
|
-
|
|
479
|
-
`string`
|
|
480
|
-
|
|
481
|
-
##### listener
|
|
482
|
-
|
|
483
|
-
`Function`
|
|
484
|
-
|
|
485
|
-
#### Returns
|
|
486
|
-
|
|
487
|
-
[`LRUCache`](LRUCache.md)
|
|
488
|
-
|
|
489
|
-
***
|
|
490
|
-
|
|
491
|
-
### peek()
|
|
492
|
-
|
|
493
|
-
> **peek**(`id`): `any`
|
|
494
|
-
|
|
495
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:125
|
|
496
|
-
|
|
497
|
-
Returns the value of an item in the cache without updating its last-used time.
|
|
498
|
-
|
|
499
|
-
#### Parameters
|
|
500
|
-
|
|
501
|
-
##### id
|
|
502
|
-
|
|
503
|
-
`any`
|
|
504
|
-
|
|
505
|
-
The key of the item to retrieve.
|
|
506
|
-
|
|
507
|
-
#### Returns
|
|
508
|
-
|
|
509
|
-
`any`
|
|
510
|
-
|
|
511
|
-
- Returns the value of the item, or `undefined` if the item was not found in the cache or has expired.
|
|
512
|
-
|
|
513
|
-
#### Example
|
|
514
|
-
|
|
515
|
-
```ts
|
|
516
|
-
const value = cache.peek('key1');
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
***
|
|
520
|
-
|
|
521
|
-
### reset()
|
|
522
|
-
|
|
523
|
-
> **reset**(`options`?): [`LRUCache`](LRUCache.md)
|
|
524
|
-
|
|
525
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:155
|
|
526
|
-
|
|
527
|
-
#### Parameters
|
|
528
|
-
|
|
529
|
-
##### options?
|
|
530
|
-
|
|
531
|
-
`number` | `ILRUCacheOptions`
|
|
532
|
-
|
|
533
|
-
#### Returns
|
|
534
|
-
|
|
535
|
-
[`LRUCache`](LRUCache.md)
|
|
536
|
-
|
|
537
|
-
***
|
|
538
|
-
|
|
539
|
-
### set()
|
|
540
|
-
|
|
541
|
-
> **set**(`id`, `value`, `expires`?): `any`
|
|
542
|
-
|
|
543
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:146
|
|
544
|
-
|
|
545
|
-
Adds or updates an item in the cache.
|
|
546
|
-
|
|
547
|
-
#### Parameters
|
|
548
|
-
|
|
549
|
-
##### id
|
|
550
|
-
|
|
551
|
-
`any`
|
|
552
|
-
|
|
553
|
-
The key of the item to add or update.
|
|
554
|
-
|
|
555
|
-
##### value
|
|
556
|
-
|
|
557
|
-
`any`
|
|
558
|
-
|
|
559
|
-
The value of the item.
|
|
560
|
-
|
|
561
|
-
##### expires?
|
|
562
|
-
|
|
563
|
-
`number`
|
|
564
|
-
|
|
565
|
-
The expiration time for the item, in milliseconds. A value of 0 means no expiration time.
|
|
566
|
-
|
|
567
|
-
#### Returns
|
|
568
|
-
|
|
569
|
-
`any`
|
|
570
|
-
|
|
571
|
-
- Returns the new value of the item, or `undefined` if the item was not found in the cache or has expired.
|
|
572
|
-
|
|
573
|
-
#### Example
|
|
574
|
-
|
|
575
|
-
```ts
|
|
576
|
-
cache.set('key1', 'value1', 5000); // add an item with expiration time of 5 seconds
|
|
577
|
-
cache.set('key2', 'value2'); // add an item with default expiration time
|
|
578
|
-
```
|
|
579
|
-
|
|
580
|
-
***
|
|
581
|
-
|
|
582
|
-
### setDefaultOptions()
|
|
583
|
-
|
|
584
|
-
> **setDefaultOptions**(`options`?): `any`
|
|
585
|
-
|
|
586
|
-
Defined in: node\_modules/.pnpm/secondary-cache@2.0.1/node\_modules/secondary-cache/lib/lru-cache.d.ts:187
|
|
587
|
-
|
|
588
|
-
Sets the default options for LRUCache.
|
|
589
|
-
|
|
590
|
-
#### Parameters
|
|
591
|
-
|
|
592
|
-
##### options?
|
|
593
|
-
|
|
594
|
-
The options for LRUCache, which can be of type ILRUCacheOptions or number.
|
|
595
|
-
If the options is a number, it represents the maxCapacity of the cache
|
|
596
|
-
|
|
597
|
-
`number` | `ILRUCacheOptions`
|
|
598
|
-
|
|
599
|
-
#### Returns
|
|
600
|
-
|
|
601
|
-
`any`
|