RandomKey returns a random key from the currently selected database
(ctx *Context, txn *db.Transaction)
| 346 | |
| 347 | // RandomKey returns a random key from the currently selected database |
| 348 | func RandomKey(ctx *Context, txn *db.Transaction) (OnCommit, error) { |
| 349 | kv := txn.Kv() |
| 350 | key, err := kv.RandomKey() |
| 351 | if err != nil { |
| 352 | return nil, errors.New("ERR " + err.Error()) |
| 353 | } |
| 354 | if key == nil { |
| 355 | return NullBulkString(ctx.Out), nil |
| 356 | } |
| 357 | return BulkString(ctx.Out, string(key)), nil |
| 358 | } |
| 359 | |
| 360 | // Touch alters the last access time of a key(s) |
| 361 | func Touch(ctx *Context, txn *db.Transaction) (OnCommit, error) { |
nothing calls this directly
no test coverage detected