Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@aomex/cache

Package Overview
Dependencies
Maintainers
0
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aomex/cache - npm Package Compare versions

Comparing version 3.10.0 to 3.11.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [3.11.0](https://github.com/aomex/aomex/compare/v3.10.0...v3.11.0) (2024-11-07)
### Features
* **cache:** 支持自动生成key ([5316cc4](https://github.com/aomex/aomex/commit/5316cc4a514e89307c302dac4689b81cf8b1fa71))
# [3.10.0](https://github.com/aomex/aomex/compare/v3.9.0...v3.10.0) (2024-11-02)

@@ -8,0 +19,0 @@

6

dist/index.d.ts

@@ -126,4 +126,4 @@ declare abstract class CacheAdapter {

decorate<T extends Caching.Types | null, P extends (...args: any[]) => Promise<T>, Q extends NonNullable<T>>(opts: {
key: string | ((...args: Parameters<P>) => string);
duration?: number;
key?: string | ((...args: Parameters<P>) => string);
duration: number;
/**

@@ -133,3 +133,3 @@ * 当数据源返回null或者undefined时,则返回默认值

defaultValue?: Q;
}): (originalMethod: P, _context: ClassMethodDecoratorContext) => (this: object, ...args: Parameters<P>) => Promise<any>;
}): (originalMethod: P, context: ClassMethodDecoratorContext) => (this: object, ...args: Parameters<P>) => Promise<any>;
protected encodeValue(value: Caching.Types): string;

@@ -136,0 +136,0 @@ protected decodeValue(value: string | null, defaultValue?: Caching.Types): any;

@@ -151,5 +151,5 @@ // src/cache-adapter.ts

const { key: getKey, duration, defaultValue = null } = opts;
return (originalMethod, _context) => {
return (originalMethod, context) => {
return async function(...args) {
const key = typeof getKey === "string" ? getKey : getKey.apply(this, args);
const key = getKey === void 0 ? `${"displayName" in this && typeof this.displayName === "string" ? this.displayName : this.constructor.name}-${String(context.name)}-${JSON.stringify(args)}` : typeof getKey === "string" ? getKey : getKey.apply(this, args);
let value = await instance.get(key);

@@ -156,0 +156,0 @@ if (value === null) {

{
"name": "@aomex/cache",
"version": "3.10.0",
"version": "3.11.0",
"description": "缓存基础类",

@@ -34,5 +34,5 @@ "type": "module",

"devDependencies": {
"@aomex/common": "^3.10.0"
"@aomex/common": "^3.11.0"
},
"scripts": {}
}

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