{"_id":"553d394e9660ba0d00569d0d","version":{"_id":"553d394d9660ba0d00569d07","project":"543467200ef9c00800164ecc","forked_from":"54bedb2fffb79c320030db1f","__v":1,"createdAt":"2015-04-26T19:15:25.245Z","releaseDate":"2015-04-26T19:15:25.245Z","categories":["553d394d9660ba0d00569d08","553d394d9660ba0d00569d09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.11.2","version":"0.11.2"},"category":{"_id":"553d394d9660ba0d00569d09","pages":["553d394e9660ba0d00569d0a","553d394e9660ba0d00569d0b","553d394e9660ba0d00569d0c","553d394e9660ba0d00569d0d","553d394e9660ba0d00569d0e","553d394e9660ba0d00569d0f","553d394e9660ba0d00569d10","553d394e9660ba0d00569d11","553d394e9660ba0d00569d12"],"project":"543467200ef9c00800164ecc","__v":1,"version":"553d394d9660ba0d00569d07","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-15T18:17:35.811Z","from_sync":false,"order":1,"slug":"extensions","title":"EXTENSIONS"},"githubsync":"","user":"543466ea0e8e2b0e00341818","__v":0,"project":"543467200ef9c00800164ecc","metadata":{"title":"","description":"","image":[]},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-15T18:18:12.308Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"never","params":[],"url":""},"isReference":false,"order":2,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"gredis - a redis extension for glim\"\n}\n[/block]\ngredis is a glim framework extension for bringing up redis features to glim framework. It uses [redis-py](https://github.com/andymccurdy/redis-py) which is the most popular redis library for python.\n\n# Installation\n- Clone the repo\n- Move gredis folder into `ext`\n- Remove `.git` folder\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# install glim-extensions from pip\\npip install glim-extensions\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\n# Confguration\n- Append gredis dependancy to extensions in your config file;\n- Add the following config to the extensions config;\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"config = {\\n    'extensions' : {\\n        'gredis' : {\\n            'default' : {\\n                'host' : 'localhost',\\n                'port' : '6379',\\n                'db'   : 0\\n            }\\n            # add a new dict for connecting multiple redis\\n            # servers\\n        }\\n    },\\n    # ...\\n}\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\nHere `default` is used for connection aliasing. Gredis can handle multiple connections.\n\nStart your web server and that's it!\n\n# Usage\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from glim_extensions.gredis import Redis\\n\\n# performs operations in default connection\\nRedis.set('foo', 'bar')\\nRedis.set('foo', 'bar')\\n\\n# performs operations in aliased connection\\nRedis.connection('connection-name').set('foo', 'bar')\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"redis","type":"basic","title":"Redis"}
[block:api-header] { "type": "basic", "title": "gredis - a redis extension for glim" } [/block] gredis is a glim framework extension for bringing up redis features to glim framework. It uses [redis-py](https://github.com/andymccurdy/redis-py) which is the most popular redis library for python. # Installation - Clone the repo - Move gredis folder into `ext` - Remove `.git` folder [block:code] { "codes": [ { "code": "# install glim-extensions from pip\npip install glim-extensions", "language": "shell" } ] } [/block] # Confguration - Append gredis dependancy to extensions in your config file; - Add the following config to the extensions config; [block:code] { "codes": [ { "code": "config = {\n 'extensions' : {\n 'gredis' : {\n 'default' : {\n 'host' : 'localhost',\n 'port' : '6379',\n 'db' : 0\n }\n # add a new dict for connecting multiple redis\n # servers\n }\n },\n # ...\n}", "language": "python" } ] } [/block] Here `default` is used for connection aliasing. Gredis can handle multiple connections. Start your web server and that's it! # Usage [block:code] { "codes": [ { "code": "from glim_extensions.gredis import Redis\n\n# performs operations in default connection\nRedis.set('foo', 'bar')\nRedis.set('foo', 'bar')\n\n# performs operations in aliased connection\nRedis.connection('connection-name').set('foo', 'bar')", "language": "python" } ] } [/block]