Skip to main content

TOUCH

Syntax​

TOUCH keys [key ...]

Module​

generic

Categories​

keyspace read fast

Description​

Alters the last access time or access count of the key(s) depending on whether LFU or LRU strategy was used. A key is ignored if it does not exist. This commands returns the number of keys that were touched.

Examples​

Touch a key:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
touched, err := db.Touch("key1")

Touch multiple keys:

db, err := sugardb.NewSugarDB()
if err != nil {
log.Fatal(err)
}
touched, err := db.Touch("key1", "key2", "key3")