Skip to content

Commit 85e04e0

Browse files
committed
chore: update README, fix dependencies
1 parent aa3edaa commit 85e04e0

File tree

4 files changed

+22
-870
lines changed

4 files changed

+22
-870
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,26 @@ pnpm add fast-memory-cache
2828

2929
## Usage
3030

31+
### TypeScript
32+
33+
```ts
34+
import MemoryCache from 'fast-memory-cache';
35+
36+
interface User {
37+
id: number;
38+
name: string;
39+
}
40+
41+
const cache = new MemoryCache();
42+
43+
// Type-safe storage and retrieval
44+
cache.set<User>('user', { id: 1, name: 'John' });
45+
const user = cache.get<User>('user'); // User type
46+
47+
// With expiration
48+
cache.set<string>('token', 'abc123', 300); // expires in 5 minutes
49+
```
50+
3151
### JavaScript
3252

3353
```js
@@ -52,26 +72,6 @@ cache.delete('user');
5272
cache.clear();
5373
```
5474

55-
### TypeScript
56-
57-
```ts
58-
import MemoryCache = require('fast-memory-cache');
59-
60-
interface User {
61-
id: number;
62-
name: string;
63-
}
64-
65-
const cache = new MemoryCache();
66-
67-
// Type-safe storage and retrieval
68-
cache.set<User>('user', { id: 1, name: 'John' });
69-
const user = cache.get<User>('user'); // User type
70-
71-
// With expiration
72-
cache.set<string>('token', 'abc123', 300); // expires in 5 minutes
73-
```
74-
7575
## API
7676

7777
### Constructor

0 commit comments

Comments
 (0)