Skip to content

Commit

Permalink
Random
Browse files Browse the repository at this point in the history
  • Loading branch information
gerold-penz committed Aug 20, 2024
1 parent f245be7 commit d6a5455
Showing 1 changed file with 40 additions and 39 deletions.
79 changes: 40 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,17 @@ The ideas for the implementation come from
- [`get()`](#read-value)
- [`getSet()`](#read-and-write-value-in-one-step)
- [`getValues()`](#read-multiple-values)
- [`getRandomValue()`](#read-random-value)
- `getValuesSet()` --> Set with values
- Write and Read Items
- [`setItems()`](#write-multiple-items)
- [`getItem()`](#read-item)
- [`getItems()`](#read-multiple-items)
- [`getRandomItem()`](#read-random-item)
- `getItemsObject()` --> Object with items
- `getItemsMap()` --> Map with items
- [Read and Write Binary Files (Images)](#read-and-write-binary-files-images)
- Keys
- [`has()`](#has-key)
- [`getKeys()`](#read-multiple-keys)
- [`getRandomKey()`](#random-key)
- [`rename()`](#rename-key)
- Delete Items
- [`delete()`](#delete-items)
Expand All @@ -51,6 +48,10 @@ The ideas for the implementation come from
- [Cache Values with TTL](#cache-values-with-ttl)
- [`setTtl()`](#set-ttl)
- [`getTtl()`](#get-ttl)
- Random
- [`getRandomValue()`](#read-random-value)
- [`getRandomItem()`](#read-random-item)
- [`getRandomKey()`](#random-key)
- Math
- [`incr()`](#increment)
- [`decr()`](#decrement)
Expand Down Expand Up @@ -314,18 +315,6 @@ store.values // --> [ "German", "English", "Italian" ]
```


## Read Random Value

```typescript
getRandomValue(): any // --> random value
randomValue() // --> alias for getRandomValue()
```

Returns a random value or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Write Multiple Items

```typescript
Expand Down Expand Up @@ -427,18 +416,6 @@ store.items // --> [
```


## Read Random Item

```typescript
getRandomItem() // --> random item
randomItem() // --> alias for getRandomItem()
```

Returns a random item or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Read and Write Binary Files (Images)

SQLite has no problem with images and other binaries.
Expand Down Expand Up @@ -555,18 +532,6 @@ store.getKeys(["language:de", "language:fr"]) // --> ["language:de"]
```


## Random Key

```typescript
getRandomKey() // --> random key
randomKey() // --> alias for getRandomKey()
```

Returns a random key or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Rename Key

```typescript
Expand Down Expand Up @@ -815,6 +780,42 @@ store.getTtl("my-key") // --> 19999
```


## Read Random Value

```typescript
getRandomValue(): any // --> random value
randomValue() // --> alias for getRandomValue()
```

Returns a random value or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Read Random Item

```typescript
getRandomItem() // --> random item
randomItem() // --> alias for getRandomItem()
```

Returns a random item or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Random Key

```typescript
getRandomKey() // --> random key
randomKey() // --> alias for getRandomKey()
```

Returns a random key or `undefined` if no valid item was found.
Inspired by: [https://docs.keydb.dev/docs/commands/#randomkey](https://docs.keydb.dev/docs/commands/#randomkey)


## Increment

```typescript
Expand Down

0 comments on commit d6a5455

Please sign in to comment.