Skip to content

Instantly share code, notes, and snippets.

@kevinhooke
Created August 23, 2019 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinhooke/b13a64407b5a22da1163f99f42f32679 to your computer and use it in GitHub Desktop.
Save kevinhooke/b13a64407b5a22da1163f99f42f32679 to your computer and use it in GitHub Desktop.
redis hashes
#cli set/get entry in hash
hmset hash-name key value
hmget hash-name key
#keys in hash
hkeys hash-name
#values in hash
hvals hash-name
#spring data redis
redisTemplate.opsForHash().put("hash-name", "key", "value");
String value = redisTemplate.opsForHash().get("hash-name", "key");
#get typed HashOperations: hashname, hey, value
HashOperations<String, String, SomeClass> hashOps = redisTemplate.opsForHash();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment