Skip to content

Instantly share code, notes, and snippets.

@hkarasek
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save hkarasek/9771408 to your computer and use it in GitHub Desktop.

Select an option

Save hkarasek/9771408 to your computer and use it in GitHub Desktop.
Snipped form tutorial at http://blog.hkar.eu
import redis
# připojení k serveru
# host localhost
# port 6379
# database 0
rd = redis.StrictRedis(host='localhost', port=6379, db=0)
rd.set('guacamole', 'ahoj') # pro 'guacamole' (klíč) přiřaď 'ahoj' (hodnotu)
text = rd.get('guacamole') # získání hodnoty 'guacamole'
print(text)
rd.delete('guacamole') # smazání klíče 'guacamole' z redisu
text = rd.get('guacamole') # get value
print(text) # vrátí 'None', protože klíč již neexistuje
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment