Skip to content

Commit

Permalink
renaming variables in README
Browse files Browse the repository at this point in the history
  • Loading branch information
kwertop committed Nov 28, 2023
1 parent b5f584e commit c984798
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ npm i persistent-node-cache
```typescript
import { PersistentNodeCache } from "persistent-node-cache";

const persistentCache = new PersistentNodeCache("mycache", 1000);
const cache = new PersistentNodeCache("mycache", 1000);
```

#### Options
Expand All @@ -47,28 +47,28 @@ Please refer to **node-cache** docs for an extensive list of all operations supp
#### Store a key (SET):
`persistentCache.set(key, val, [ttl])`
`cache.set(key, val, [ttl])`
Sets a key-value pair. Defining `ttl` is optional.
```typescript
persistentCache.set("mykey", "myval", 1000); //true
cache.set("mykey", "myval", 1000); //true
```

#### Retrieve a key (GET):

Get a key-value pair.

```typescript
persistentCache.get("mykey"); //myval
cache.get("mykey"); //myval
```

#### Delete a key (DEL):

Delete a key from cache. Returns the number of entries deleted.

```typescript
persistentCache.del("mykey"); //1
cache.del("mykey"); //1
```

### Restore/Recover Cache
Expand All @@ -77,10 +77,10 @@ The `cacheName` field should be passed to tell which cache to restore. If `dir`
previously, it should be passed during recovery as well to locate the backup files.

```typescript
const persistentCache = new PersistentNodeCache("mycache");
persistentCache.recover();
const cache = new PersistentNodeCache("mycache");
cache.recover();

persistentCache.get("mykey"); //myval
cache.get("mykey"); //myval
```

### Use Custom Serializer
Expand Down

0 comments on commit c984798

Please sign in to comment.