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

@travetto/cache

Package Overview
Dependencies
Maintainers
1
Versions
324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travetto/cache - npm Package Compare versions

Comparing version 3.0.2 to 3.0.3

10

package.json
{
"name": "@travetto/cache",
"version": "3.0.2",
"version": "3.0.3",
"description": "Caching functionality with decorators for declarative use.",

@@ -28,8 +28,8 @@ "keywords": [

"dependencies": {
"@travetto/di": "^3.0.2",
"@travetto/model": "^3.0.2"
"@travetto/di": "^3.0.3",
"@travetto/model": "^3.0.3"
},
"peerDependencies": {
"@travetto/test": "^3.0.2",
"@travetto/transformer": "^3.0.2"
"@travetto/test": "^3.0.3",
"@travetto/transformer": "^3.0.3"
},

@@ -36,0 +36,0 @@ "peerDependenciesMeta": {

<!-- This file was generated by @travetto/doc and should not be modified directly -->
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/cache/DOC.ts and execute "npx trv doc" to rebuild -->
<!-- Please modify https://github.com/travetto/travetto/tree/main/module/cache/DOC.tsx and execute "npx trv doc" to rebuild -->
# Caching
## Caching functionality with decorators for declarative use.

@@ -27,5 +28,3 @@

```
Currently, the following are packages that provide [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/service/expiry.ts#L11):
* [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") - @travetto/model: [FileModelService](https://github.com/travetto/travetto/tree/main/module/model/src/provider/file.ts#L51), [MemoryModelService](https://github.com/travetto/travetto/tree/main/module/model/src/provider/memory.ts#L54)

@@ -73,9 +72,7 @@ * [DynamoDB Model Support](https://github.com/travetto/travetto/tree/main/module/model-dynamodb#readme "DynamoDB backing for the travetto model module.") - @travetto/model-dynamodb

### [@Cache](https://github.com/travetto/travetto/tree/main/module/cache/src/decorator.ts#L13)
### Cache
The [@Cache](https://github.com/travetto/travetto/tree/main/module/cache/src/decorator.ts#L13) decorator supports configurations on:
* `name` the field name of the current class which points to the desired cache source.
* `config` the additional/optional config options, on a per invocation basis
* `name` the field name of the current class which points to the desired cache source.
* `config` the additional/optional config options, on a per invocation basis
* `keySpace` the key space within the cache. Defaults to class name plus method name.

@@ -89,4 +86,3 @@ * `key` the function will use the inputs to determine the cache key, defaults to all params `JSON.stringify`ied

### [@EvictCache](https://github.com/travetto/travetto/tree/main/module/cache/src/decorator.ts#L40)
### EvictCache
Additionally, there is support for planned eviction via the [@EvictCache](https://github.com/travetto/travetto/tree/main/module/cache/src/decorator.ts#L40) decorator. On successful execution of a method with this decorator, the matching keySpace/key value will be evicted from the cache. This requires coordination between multiple methods, to use the same `keySpace` and `key` to compute the expected key.

@@ -128,3 +124,2 @@

## Extending the Cache Service
By design, the [CacheService](https://github.com/travetto/travetto/tree/main/module/cache/src/service.ts#L29) relies solely on the [Data Modeling Support](https://github.com/travetto/travetto/tree/main/module/model#readme "Datastore abstraction for core operations.") module. Specifically on the [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/service/expiry.ts#L11). This combines basic support for CRUD as well as knowledge of how to manage expirable content. Any model service that honors these contracts is a valid candidate to power the [CacheService](https://github.com/travetto/travetto/tree/main/module/cache/src/service.ts#L29). The [CacheService](https://github.com/travetto/travetto/tree/main/module/cache/src/service.ts#L29) is expecting the model service to be registered using the @travetto/cache:model:

@@ -131,0 +126,0 @@

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