Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tom910/effective-cache
https://github.com/tom910/effective-cache
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/tom910/effective-cache
- Owner: Tom910
- License: mit
- Created: 2023-10-11T16:53:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-12T15:09:10.000Z (about 1 year ago)
- Last Synced: 2023-10-15T03:51:45.439Z (about 1 year ago)
- Language: TypeScript
- Size: 54.7 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Cache
This is a repository for different caching algorithms## How to Install
```bash
npm install --save effective-cache
```## How to Use
### S3-FIFO cache example
More information about this algorithm you can find in [this article](https://amarchenko.dev/blog/2023-10-12-memory-cache/)
size: 0.8Kb after gzip
```typescript
import { S3FifoCache } from 'effective-cache';const cache = new S3FifoCache(100);
cache.set("key", "value");
cache.set("key2", "value");
cache.get("key") // -> "value"cache.has("key") // -> true
cache.delete("key");
cache.get("key") // -> undefinedcache.clear();
```