node-ts-cache icon indicating copy to clipboard operation
node-ts-cache copied to clipboard

feat: new Methods

Open EhsanFox opened this issue 3 years ago • 1 comments

What this PR is about: Adding some new methods for easier and better access and management

What has been changed:

  • Created removeItem method in FS-Storage, Memory-Storage, CacheContainer, and Storage types
  • Created getAll method that would return all saved Data in FS-Storage, Memory-Storage, CacheContainer, and Storage types
  • Added an option to return the saved data before removing it on CacheContainer Class
  • Instead of setting a key value to null which still takes storage, we remove them with removeItem method

What needs to be changed: unfortunately, I don't have any experience with Redis, so I left storage-elasticsearch and storage-ioredis unchanged, I hope you can fix or find a solution for them.

Possible solutions: We can remove the removeItem & getAll methods from CacheContainer, however, users can still access those methods from storage directly and we can implant generic typings of methods in the IStorage interface instead.

EhsanFox avatar Apr 28 '22 15:04 EhsanFox

@havsar I would love to hear your idea and your response to this PR and some information such as the time you will be able to review this PR File changes and the Merge time of it.

EhsanFox avatar Apr 29 '22 15:04 EhsanFox