@travetto/cache 5.0.0-rc.9 → 5.0.0

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/README.md CHANGED
@@ -26,7 +26,6 @@ npm install @travetto/model-{provider}
26
26
  yarn add @travetto/model-{provider}
27
27
  ```
28
28
  Currently, the following are packages that provide [Expiry](https://github.com/travetto/travetto/tree/main/module/model/src/service/expiry.ts#L11):
29
- * [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#L49), [MemoryModelService](https://github.com/travetto/travetto/tree/main/module/model/src/provider/memory.ts#L54)
30
29
  * [DynamoDB Model Support](https://github.com/travetto/travetto/tree/main/module/model-dynamodb#readme "DynamoDB backing for the travetto model module.") - @travetto/model-dynamodb
31
30
  * [Elasticsearch Model Source](https://github.com/travetto/travetto/tree/main/module/model-elasticsearch#readme "Elasticsearch backing for the travetto model module, with real-time modeling support for Elasticsearch mappings.") - @travetto/model-elasticsearch
32
31
  * [MongoDB Model Support](https://github.com/travetto/travetto/tree/main/module/model-mongo#readme "Mongo backing for the travetto model module.") - @travetto/model-mongo
@@ -35,6 +34,8 @@ Currently, the following are packages that provide [Expiry](https://github.com/t
35
34
  * [PostgreSQL Model Service](https://github.com/travetto/travetto/tree/main/module/model-postgres#readme "PostgreSQL backing for the travetto model module, with real-time modeling support for SQL schemas.") - @travetto/model-postgres
36
35
  * [MySQL Model Service](https://github.com/travetto/travetto/tree/main/module/model-mysql#readme "MySQL backing for the travetto model module, with real-time modeling support for SQL schemas.") - @travetto/model-mysql
37
36
  * [SQLite Model Service](https://github.com/travetto/travetto/tree/main/module/model-sqlite#readme "SQLite backing for the travetto model module, with real-time modeling support for SQL schemas.") - @travetto/model-sqlite
37
+ * [Memory Model Support](https://github.com/travetto/travetto/tree/main/module/model-memory#readme "Memory backing for the travetto model module.") - @travetto/model-memory
38
+ * [File Model Support](https://github.com/travetto/travetto/tree/main/module/model-file#readme "File system backing for the travetto model module.") - @travetto/model-file
38
39
 
39
40
  ## Decorators
40
41
  The caching framework provides method decorators that enables simple use cases. One of the requirements to use the caching decorators is that the method arguments, and return values need to be serializable into [JSON](https://www.json.org). Any other data types are not currently supported and would require either manual usage of the caching services directly, or specification of serialization/deserialization routines in the cache config.
@@ -45,7 +46,7 @@ Additionally, to use the decorators you will need to have a [CacheService](https
45
46
 
46
47
  **Code: Using decorators to cache expensive async call**
47
48
  ```typescript
48
- import { MemoryModelService } from '@travetto/model';
49
+ import { MemoryModelService } from '@travetto/model-memory';
49
50
  import { Cache, CacheService } from '@travetto/cache';
50
51
 
51
52
  async function request(url: string): Promise<string> {
@@ -86,7 +87,7 @@ Additionally, there is support for planned eviction via the [@EvictCache](https:
86
87
 
87
88
  **Code: Using decorators to cache/evict user access**
88
89
  ```typescript
89
- import { MemoryModelService } from '@travetto/model';
90
+ import { MemoryModelService } from '@travetto/model-memory';
90
91
  import { Cache, EvictCache, CacheService } from '@travetto/cache';
91
92
 
92
93
  class User { }
@@ -123,7 +124,8 @@ By design, the [CacheService](https://github.com/travetto/travetto/tree/main/mod
123
124
  **Code: Registering a Custom Model Source**
124
125
  ```typescript
125
126
  import { InjectableFactory } from '@travetto/di';
126
- import { MemoryModelService, ModelExpirySupport } from '@travetto/model';
127
+ import { ModelExpirySupport } from '@travetto/model';
128
+ import { MemoryModelService } from '@travetto/model-memory';
127
129
  import { CacheModelⲐ } from '@travetto/cache';
128
130
 
129
131
  class Config {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/cache",
3
- "version": "5.0.0-rc.9",
3
+ "version": "5.0.0",
4
4
  "description": "Caching functionality with decorators for declarative use.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -25,12 +25,12 @@
25
25
  "directory": "module/cache"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/di": "^5.0.0-rc.9",
29
- "@travetto/model": "^5.0.0-rc.9"
28
+ "@travetto/di": "^5.0.0",
29
+ "@travetto/model": "^5.0.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "@travetto/test": "^5.0.0-rc.9",
33
- "@travetto/transformer": "^5.0.0-rc.6"
32
+ "@travetto/test": "^5.0.0",
33
+ "@travetto/transformer": "^5.0.0"
34
34
  },
35
35
  "peerDependenciesMeta": {
36
36
  "@travetto/transformer": {
package/src/util.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Util } from '@travetto/runtime';
1
+ import { BinaryUtil } from '@travetto/runtime';
2
2
 
3
3
  import { CoreCacheConfig } from './types';
4
4
 
@@ -35,6 +35,6 @@ export class CacheUtil {
35
35
  const input = config.params?.(params) ?? params;
36
36
  const keyParams = config.key?.(...input) ?? input;
37
37
  const key = `${config.keySpace!}_${this.toSafeJSON(keyParams)}`;
38
- return Util.hash(key, 32);
38
+ return BinaryUtil.hash(key, 32);
39
39
  }
40
40
  }