Releases: angelnikolov/ts-cacheable
1.0.11
What's Changed
- Bump follow-redirects from 1.14.8 to 1.15.4 by @dependabot[bot] in #142
- Bump browserify-sign from 4.0.4 to 4.2.2 by @dependabot[bot] in #140
- Bump tmp from 0.2.1 to 0.2.4 by @dependabot[bot] in #150
Full Changelog: 1.0.10...1.0.11
1.0.10
What's Changed
- Removed rxjs as a dependency. by @angelnikolov in #127
- Bump socket.io-parser from 4.0.4 to 4.0.5 by @dependabot in #126
- Bump minimatch from 3.0.4 to 3.1.2 by @dependabot in #128
- Bump engine.io from 6.2.0 to 6.2.1 by @dependabot in #129
- Bump ua-parser-js from 0.7.31 to 0.7.33 by @dependabot in #132
- Bump engine.io and socket.io by @dependabot in #133
- Bump socket.io-parser from 4.2.2 to 4.2.3 by @dependabot in #134
- chore: 🏷️ Update cacheModifier types by @pcbowers in #139
- Bump @babel/traverse from 7.16.3 to 7.23.2 by @dependabot in #138
New Contributors
Full Changelog: 1.0.7...1.0.10
1.0.7
What's Changed
- Bump follow-redirects from 1.7.0 to 1.14.8 by @dependabot in #117
- Bump async from 2.6.2 to 2.6.4 by @dependabot in #120
- Bump karma from 4.1.0 to 6.3.16 by @dependabot in #118
- Instant cache busting by @ragtam in #123
New Contributors
Full Changelog: 1.0.6...1.0.7
1.0.6
Added ^7.4.0 to the rxjs peer dependencies and updated typecsript to '^4.3.2'.
What's Changed
- Bump lodash from 4.17.19 to 4.17.21 by @dependabot in #107
- Bump handlebars from 4.7.3 to 4.7.7 by @dependabot in #106
- Bump hosted-git-info from 2.7.1 to 2.8.9 by @dependabot in #108
- typo(specs): getData.. instead of getDate... by @Serrulien in #109
- Bump path-parse from 1.0.6 to 1.0.7 by @dependabot in #113
- Bump rxjs version to v7.4.0 by @Hacklone in #114
New Contributors
- @Serrulien made their first contribution in #109
- @Hacklone made their first contribution in #114
Full Changelog: 1.0.5...1.0.6
1.0.5
Exposed an additional ctx (Context) parameter for all storage strategy methods. For ex. - abstract add(entity: ICachePair<any>, cacheKey: string, ctx?: any): void;
With that, you get access to the instance which called the decorated method. This is useful for stateful operations or properly caching when using multiple instances of the same class as described here.
1.0.4
Deprecated updateAtIndex and removeAtIndex in IStorageStrategy and IStorageStrategy.
Use update and remove.
You will also find that the signature of remove is now remove?(index: number, entity: ICachePair<any>, cacheKey: string): void;
The only difference here is that the removeable entity is passed to the callback so it can be used for finding the correct object to remove in the selected storage.
1.0.3
Added a cacheModifier parameter to the Cacheable configuration.
It can be used as a way to access the cached data for the decorated method and modify it.
You can get access to the cached data and change it by providing a cacheModifier subject to your decorator like this:
const cacheModifier = new Subject<any>();
@Cacheable({
cacheModifier
})
getMutableData(parameter: string) {
return this.getData(parameter);
}Then, say you want to change the cached data somewhere in your code.
You can emit a callback through the cacheModifier subject, which will be called upon all your cached data for this decorator, by:
cacheModifier.next((data: any[]) => {
data.find(p => p.parameters[0] === 'test').response.payload = 'test_modified';
return data;
});What happens here is that we look for the cache under the 'test' parameter here and modify it to a different string.
data is all the caches for this method so you can change it in whatever way you want.
Now, if this method is called with the same parameter as before, it will still return cached data, but this time modified.
You can also delete and add more data to the cache.
1.0.1
Library has been renamed to ts-cacheable
DOMStorageStrategy is now deprecated. Use LocalStorageStrategy instead.
1.4.0
Description
We migrated the project structure to es modules. Depending on what environment you build the project with (Node, web) you will get the correct assets imported.
Why
The default module format we used to support was CommonJS, which was non tree-shakeable. That resulted in the library adding quite a bit of code to webpack bundles (mainly due to the whole rxjs library being included).
Breaking changes
DOMStorageStrategy is now imported from ngx-cacheable directly like:
import { DOMStorageStrategy } from 'ngx-cacheable'