aboutsummaryrefslogtreecommitdiff
path: root/wqflask/utility/temp_data.py
diff options
context:
space:
mode:
authorZachary Sloan2013-06-20 22:20:23 +0000
committerZachary Sloan2013-06-20 22:20:23 +0000
commit4ffee373494170e708678039dca132f1bd729ab1 (patch)
treea9d6054380f5a9d612a4d1d88889f68ea4923a75 /wqflask/utility/temp_data.py
parent939058c4a3b668037974f2876b072c4be008da26 (diff)
parent52ac4b6e1c014801080cbbcad53df868058d2657 (diff)
downloadgenenetwork2-4ffee373494170e708678039dca132f1bd729ab1.tar.gz
Merge branch 'flask'
Diffstat (limited to 'wqflask/utility/temp_data.py')
-rw-r--r--wqflask/utility/temp_data.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/wqflask/utility/temp_data.py b/wqflask/utility/temp_data.py
new file mode 100644
index 00000000..004d45c6
--- /dev/null
+++ b/wqflask/utility/temp_data.py
@@ -0,0 +1,25 @@
+from __future__ import print_function, division, absolute_import
+from redis import Redis
+
+import simplejson as json
+
+class TempData(object):
+
+ def __init__(self, temp_uuid):
+ self.temp_uuid = temp_uuid
+ self.redis = Redis()
+ self.key = "tempdata:{}".format(self.temp_uuid)
+
+ def store(self, field, value):
+ self.redis.hset(self.key, field, value)
+ self.redis.expire(self.key, 60*15) # Expire in 15 minutes
+
+ def get_all(self):
+ return self.redis.hgetall(self.key)
+
+
+if __name__ == "__main__":
+ redis = Redis()
+ for key in redis.keys():
+ for field in redis.hkeys(key):
+ print("{}.{}={}".format(key, field, redis.hget(key, field)))