New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@avanio/expire-cache

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@avanio/expire-cache - npm Package Compare versions

Comparing version 0.6.1 to 0.6.2

44

dist/index.d.ts
import { CacheEventsMap, ICache as ICache$1 } from '@luolapeikko/cache-types';
import { LogMapping, ILoggerLike } from '@avanio/logger-like';
import { LogMapping, ISetLogMapping, ILoggerLike } from '@avanio/logger-like';
import { EventEmitter } from 'events';

@@ -210,3 +210,3 @@ import { EventEmitter as EventEmitter$1 } from 'stream';

*/
declare const defaultLogMap$1: {
declare const defaultLogMap$2: {
readonly cleanExpired: 0;

@@ -223,3 +223,3 @@ readonly clear: 0;

};
type ExpireCacheLogMapType = LogMapping<keyof typeof defaultLogMap$1>;
type ExpireCacheLogMapType = LogMapping<keyof typeof defaultLogMap$2>;
/**

@@ -231,3 +231,3 @@ * ExpireCache class that implements the ICache interface with value expiration and expires on read operations

*/
declare class ExpireCache<Payload, Key = string> extends EventEmitter<CacheEventsMap<Payload, Key>> implements ICache$1<Payload, Key> {
declare class ExpireCache<Payload, Key = string> extends EventEmitter<CacheEventsMap<Payload, Key>> implements ICache$1<Payload, Key>, ISetLogMapping<ExpireCacheLogMapType> {
private readonly cache;

@@ -259,2 +259,4 @@ private readonly cacheTtl;

setExpireMs(expireMs: number | undefined): void;
setLogger(logger: ILoggerLike | undefined): void;
setLogMapping(logMapping: Partial<ExpireCacheLogMapType>): void;
/**

@@ -269,2 +271,26 @@ * Cleans expired cache entries

/**
* The default log mapping for the ExpireCache class.
* This maps each method to a log level, allowing you to control the logging output.
* By default, all logs are disabled (None level)
* @example
* const cache = new ExpireCache<string>(console, {
* get: LogLevel.Info,
* set: LogLevel.Debug,
* delete: LogLevel.Warn,
* });
*/
declare const defaultLogMap$1: {
readonly cleanExpired: 0;
readonly clear: 0;
readonly constructor: 0;
readonly delete: 0;
readonly expires: 0;
readonly get: 0;
readonly has: 0;
readonly onExpire: 0;
readonly set: 0;
readonly size: 0;
};
type ExpireTimeoutCacheLogMapType = LogMapping<keyof typeof defaultLogMap$1>;
/**
* ExpireCache class that implements the ICache interface with value expiration and expires with setTimeout

@@ -275,3 +301,3 @@ * @template Payload - The type of the cached data

*/
declare class ExpireTimeoutCache<Payload, Key = string> extends EventEmitter<CacheEventsMap<Payload, Key>> implements ICache$1<Payload, Key> {
declare class ExpireTimeoutCache<Payload, Key = string> extends EventEmitter<CacheEventsMap<Payload, Key>> implements ICache$1<Payload, Key>, ISetLogMapping<ExpireTimeoutCacheLogMapType> {
private readonly cache;

@@ -303,2 +329,4 @@ private readonly cacheTimeout;

setExpireMs(expireMs: number | undefined): void;
setLogger(logger: ILoggerLike | undefined): void;
setLogMapping(logMapping: Partial<ExpireCacheLogMapType>): void;
private clearTimeout;

@@ -344,3 +372,3 @@ private notifyExpires;

*/
declare abstract class TieredCache<Tiers extends TierType<unknown, string>[], TimeoutEnum extends number, Key> extends EventEmitter$1<MultiTierCacheEvents<Tiers>> {
declare abstract class TieredCache<Tiers extends TierType<unknown, string>[], TimeoutEnum extends number, Key> extends EventEmitter$1<MultiTierCacheEvents<Tiers>> implements ISetLogMapping<TieredCacheLogMapType> {
abstract readonly cacheName: string;

@@ -384,2 +412,4 @@ protected readonly cache: Map<Key, Tiers[number]>;

status(): TieredCacheStatus<Tiers>;
setLogger(logger: ILoggerLike | undefined): void;
setLogMapping(logMapping: Partial<ExpireCacheLogMapType>): void;
private setTimeout;

@@ -414,2 +444,2 @@ private clearTimeoutKey;

export { ExpireCache, type ExpireCacheLogMapType, ExpireTimeoutCache, type GetCacheTier, type IAsyncCache, type IAsyncCacheOnClearCallback, type ICache, type ICacheOnClearCallback, type ICacheOrAsync, type TierType, TieredCache, type TieredCacheLogMapType, type TieredCacheStatus };
export { ExpireCache, type ExpireCacheLogMapType, ExpireTimeoutCache, type ExpireTimeoutCacheLogMapType, type GetCacheTier, type IAsyncCache, type IAsyncCacheOnClearCallback, type ICache, type ICacheOnClearCallback, type ICacheOrAsync, type TierType, TieredCache, type TieredCacheLogMapType, type TieredCacheStatus };

@@ -125,2 +125,8 @@ "use strict";

}
setLogger(logger) {
this.logger.setLogger(logger);
}
setLogMapping(logMapping) {
this.logger.setLogMapping(logMapping);
}
/**

@@ -251,2 +257,8 @@ * Cleans expired cache entries

}
setLogger(logger) {
this.logger.setLogger(logger);
}
setLogMapping(logMapping) {
this.logger.setLogMapping(logMapping);
}
clearTimeout(key) {

@@ -408,2 +420,8 @@ const entry = this.cacheTimeout.get(key);

}
setLogger(logger) {
this.logger.setLogger(logger);
}
setLogMapping(logMapping) {
this.logger.setLogMapping(logMapping);
}
setTimeout(key, timeout) {

@@ -410,0 +428,0 @@ const oldTimeout = this.cacheTimeout.get(key);

10

package.json
{
"name": "@avanio/expire-cache",
"version": "0.6.1",
"version": "0.6.2",
"description": "Typescript/Javascript cache with expiration",

@@ -59,7 +59,7 @@ "main": "./dist/index.js",

"devDependencies": {
"@avanio/logger-like": "^0.2.5",
"@avanio/logger-like": "^0.2.7",
"@luolapeikko/cache-types": "^0.0.7",
"@stylistic/eslint-plugin": "^2.9.0",
"@stylistic/eslint-plugin-ts": "^2.9.0",
"@types/node": "^20.17.0",
"@types/node": "^20.17.1",
"@types/sinon": "^17.0.3",

@@ -80,3 +80,3 @@ "@typescript-eslint/eslint-plugin": "^8.11.0",

"ts-node": "^10.9.2",
"tsup": "^8.3.0",
"tsup": "^8.3.5",
"typescript": "^5.6.3",

@@ -87,3 +87,3 @@ "vite": "^5.4.10",

"peerDependencies": {
"@avanio/logger-like": "^0.1 || ^0.2",
"@avanio/logger-like": "^0.2.7",
"@luolapeikko/cache-types": "^0.0"

@@ -90,0 +90,0 @@ },

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc