{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"never","results":{"codes":[]},"params":[]},"next":{"description":"","pages":[]},"title":"Memcached","type":"basic","slug":"memcached","excerpt":"","body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"glim-memcached\"\n}\n[/block]\nglim-memcached is a glim framework extension for bringing up memcached features to glim. It uses [pinterest's memcache module](https://github.com/pinterest/pymemcache).\n\n# Installation\n- install [pymemcache](https://github.com/pinterest/pymemcache)\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# Configuration\nAppend the following config to the extensions config;\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"# app/config/<env>.py\\nconfig = {\\n    'extensions' : {\\n        'memcached' : {\\n            'default' : {\\n                'host' : 'localhost',\\n                'port' : 11211,\\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. Memcached 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.memcached import Cache\\n\\n# performs operations in default connection\\nCache.set('foo', 'bar')\\nCache.get('foo')\\n\\n# performs operations in aliased connection\\nCache.connection('connection-name').set('foo', 'bar')\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]","updates":[],"order":5,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"553d394e9660ba0d00569d0c","githubsync":"","user":"543466ea0e8e2b0e00341818","__v":0,"version":{"version":"0.11.2","version_clean":"0.11.2","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["553d394d9660ba0d00569d08","553d394d9660ba0d00569d09"],"_id":"553d394d9660ba0d00569d07","project":"543467200ef9c00800164ecc","forked_from":"54bedb2fffb79c320030db1f","__v":1,"createdAt":"2015-04-26T19:15:25.245Z","releaseDate":"2015-04-26T19:15:25.245Z"},"project":"543467200ef9c00800164ecc","category":{"sync":{"isSync":false,"url":""},"pages":["553d394e9660ba0d00569d0a","553d394e9660ba0d00569d0b","553d394e9660ba0d00569d0c","553d394e9660ba0d00569d0d","553d394e9660ba0d00569d0e","553d394e9660ba0d00569d0f","553d394e9660ba0d00569d10","553d394e9660ba0d00569d11","553d394e9660ba0d00569d12"],"title":"EXTENSIONS","slug":"extensions","order":1,"from_sync":false,"reference":false,"_id":"553d394d9660ba0d00569d09","project":"543467200ef9c00800164ecc","__v":1,"version":"553d394d9660ba0d00569d07","createdAt":"2014-10-15T18:17:35.811Z"},"createdAt":"2014-10-15T18:23:20.454Z"}
[block:api-header] { "type": "basic", "title": "glim-memcached" } [/block] glim-memcached is a glim framework extension for bringing up memcached features to glim. It uses [pinterest's memcache module](https://github.com/pinterest/pymemcache). # Installation - install [pymemcache](https://github.com/pinterest/pymemcache) [block:code] { "codes": [ { "code": "# install glim-extensions from pip\npip install glim-extensions", "language": "shell" } ] } [/block] # Configuration Append the following config to the extensions config; [block:code] { "codes": [ { "code": "# app/config/<env>.py\nconfig = {\n 'extensions' : {\n 'memcached' : {\n 'default' : {\n 'host' : 'localhost',\n 'port' : 11211,\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. Memcached can handle multiple connections. Start your web server and that's it! # Usage [block:code] { "codes": [ { "code": "from glim_extensions.memcached import Cache\n\n# performs operations in default connection\nCache.set('foo', 'bar')\nCache.get('foo')\n\n# performs operations in aliased connection\nCache.connection('connection-name').set('foo', 'bar')", "language": "python" } ] } [/block]