jackson88 / ng2-cache Goto Github PK
View Code? Open in Web Editor NEWClient side caching service for Angular2
License: MIT License
Client side caching service for Angular2
License: MIT License
Great handy library.
removeTag does not seem to work when using Local Storage
I have plan to use ng2-cache ,whether it support IE 10 and above browsers.why ng2cache data store in session storage instead of in memory?how to use it in cache memory instead of session storage.
ng2-cache does not ship with *.metadata.json files next to the *.d.ts files.
This is needed for AoT compiled apps (reference)
For now, I got the following error while ngc :
ngc -p tsconfig.ngc.json
Error: ENOENT: no such file or directory, open 'E:\tfswork\3\s\dist\module\node_modules\ng2-cache\src\interfaces\cache-options.interface.metadata.json'
Can you please check ?
Is it possible to add SystemJS loading support?
Hi, When I put some data to cache for 5 minutes, How to update data by the same key ?
What is size limit for data stored this way?
We had an issue where a data table was increased in size, exceeding the 5Mb limit for local storage. It became a much bigger debugging and resolving issue because no exception was thrown. Reading from the cache simply returned null, which caused the main app to resort to the fallback method of reading from the API. An exception when writing more then the max limit would have been very welcome.
With tsconfig's "strictNullChecks": true, the compilation fails with reason:
ERROR in /node_modules/ng2-cache/src/services/cache.service.ts (245,16):
Object is possibly 'undefined'.) webpack: Failed to compile
HI, first off, great package its working well good job!
I noticed your using this for Default cache options.
/** * Default cache options */ private _defaultOptions: CacheOptionsInterface = { expires: Number.MAX_VALUE, maxAge : Number.MAX_VALUE };
How long is that exactly, am i reading it right to say its indefinite until the session cache is cleared?
If so, how would you set the cache to expire to say 1 day?
ng2-cache/src/services/cache.service.ts(111,21): error TS7017: Index signature of object type implicitly has an 'any' type
There is no documentation on the CacheService.get(key: string)
method in the README. It would be nice to know all of the publicly available methods without having to sift through the source. There is only documentation on the use of CacheService.getTagData(tag: string)
.
Works perfectly for me but the doc is out of date for switching to local storage on angular 2.0.
This will work with angular 2.0:
providers: [
CacheService,
{provide: CacheStorageAbstract, useClass:CacheLocalStorage }
]
Cheers
I'm playing around with Angular and your library, trying to build jira dashboard page
It has kind of paginated api to fetch issues, and it is slow, so I'm going to cache it for better user experience
In UI I wish to display "2 hours ago" data were fetched and "reload" button
But in current implementation it is not possible
It is just a ping, seems to be an easy feature, but not sure if it will fit your vision, so just trying to start conversation without any PRs
Hi,
using your module with webpack, ts-loader 1.3 and typescript 2.1.4:
modulesModuleBuildError: Module build failed: Error: Typescript emitted no output for node_modules\ng2-cache\src\services\storage\local-storage\cache-local-storage.service.ts. You should not need to recompile .ts files in node_modules.
Please contact the package author to advise them to use --declaration --outDir.
More microsoft/TypeScript#12358
Hello All,
I am creating a custom module which contains some functionalities of centralization something that is used throughout multiple angular apps.
I am publishing this module locally including ng2-cache module.
Problem Statement: When i use ng2-cache module inside my module (i.e Core Module) and once i use this Core Module inside another app and compile, compiler throws following error
ERROR in ../app-core/dist/src/core/services/remote.service.js
Module not found: Error: Can't resolve 'ng2-cache/ng2-cache' in 'C:\Dhaval\app-core\dist\src\core\services'
@ ../app-core/dist/src/core/services/remote.service.js 13:18-48
@ ../app-core/dist/src/app.core.js
@ ./src/app-features/services/authentication/authentication.service.ts
@ ./src/app-features/app-features.module.ts
@ ./src/app/app.module.ts
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts`
Is it because i am importing custom module inside my on going custom module?
Would like to use this module with the recently released Angular 4.0.0.
Hi team,
I got problem like that.
ERROR in ./node_modules/ng2-cache/ng2-cache.ts
Module build failed: Error: C:\Users\Gildarts\Desktop\Cache\login-test\node_modules\ng2-cache\ng2-cache.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open
an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
at AngularCompilerPlugin.getCompiledFile (C:\Users\Gildarts\Desktop\Cache\login-test\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (C:\Users\Gildarts\Desktop\Cache\login-test\node_modules@ngtools\webpack\src\loader.js:467:39)
at
at process._tickCallback (internal/process/next_tick.js:160:7)
Hi @Jackson88 Can you please let us know when are you going to upgrade to angular version(>=9)
This will help to -
ng2-cache-ngcc-issue.png
.Hi,
I want to use this module with local storage and not the default session storage, when I follow the instructions on the readme file - provide(CacheStorageAbstract, { useClass: CacheLocalStorage }) I get an error - "Module has no exported member 'provide'.
Is there something that i miss?
Thanks
Dear Team,
I see that the issue after installing importing and keep provider as CacheService in component.
Uncaught Error: Encountered undefined provider! Usually this means you have a circular dependencies (might be caused by using 'barrel' index.ts files.
Below is the error, can you please help with it?
node_modules/ng2-cache/src/services/cache.service.ts(111,21): error TS7017: Index signature of object type implicitly has an 'any' type.
This blocks our production build every time. I resolve it by explicitly adding : any
and as any
to line 106 of the cache.service.ts file. The as any
is not necessary. It looks like this:
...
public getTagData(tag: string) {
let tags = this.get(this._tagsStorageKey()) || {},
result: any = {} as any;
if (tags[tag]) {
...
It's a bit inefficient as I have to apply this change every time I do an npm install or yarn.
Angular 5 uses TypeScript 2.4.2.
Now compiler fails with error:
ERROR in ./node_modules/ng2-cache/src/services/cache.service.ts
Module build failed: Error: /work/st-cloud-one-five-zero/node_modules/ng2-cache/src/services/cache.service.ts is not part of the compilation output. Please check the other error messages for details.
To workaround this I have to add
"include": [
"src/**/*",
"node_modules/ng2-cache/src/**/*"
]
into my tsconfig.json
.
Please fix error or add workaround to README.md
Hi Jackson,
I'm getting this error - "you may need appropriate loader for this file", for all files included in the package.
Just curious, is there any reason for adding source js files into this package? As far as I know, we could see only .ts files on packages right? please correct me if am wrong!
Thanks,
Hari
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.