Skip to content

Commit eabbfc1

Browse files
authored
Merge pull request #1 from uncovertruth/feature/pymemcache
Feature/pymemcache
2 parents ea4dde4 + 6255a8b commit eabbfc1

File tree

13 files changed

+192
-322
lines changed

13 files changed

+192
-322
lines changed

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
1818
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
1919
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2020
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21+

MANIFEST.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
include README.rst
1+
include README.md
22
include MANIFEST.in
3-
include setup.py
3+
include setup.py

README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# django-elastipymemcache
2+
3+
Simple Django cache backend for Amazon ElastiCache (memcached based). It uses
4+
[pymemcache](https://github.com/pinterest/pymemcache) and sets up a connection to each
5+
node in the cluster using
6+
[auto discovery](http://docs.aws.amazon.com/AmazonElastiCache/latest/UserGuide/AutoDiscovery.html)
7+
8+
## Requirements
9+
10+
* pymemcache
11+
* Django 1.7+.
12+
13+
It was written and tested on Python 2.7 and 3.5.
14+
15+
## Installation
16+
17+
Get it from [pypi](http://pypi.python.org/pypi/django-elastipymemcache)
18+
19+
```bash
20+
pip install django-elastipymemcache
21+
```
22+
23+
## Usage
24+
25+
Your cache backend should look something like this
26+
27+
```python
28+
CACHES = {
29+
'default': {
30+
'BACKEND': 'django_elastipymemcache.memcached.ElastiPyMemCache',
31+
'LOCATION': '[configuration endpoint].com:11211',
32+
}
33+
}
34+
```
35+
36+
## Testing
37+
38+
Run the tests like this
39+
40+
```bash
41+
nosetests
42+
```
43+
44+
## Thx
45+
46+
Originally forked from [django-elasticache](https://github.com/gusdan/django-elasticache)

README.rst

Lines changed: 0 additions & 131 deletions
This file was deleted.

django_elasticache/memcached.py

Lines changed: 0 additions & 121 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
VERSION = (1, 0, 1)
1+
VERSION = (0, 0, 1)
22
__version__ = '.'.join(map(str, VERSION))

django_elastipymemcache/client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from pymemcache.client.hash import HashClient
2+
3+
4+
class Client(HashClient):
5+
pass

django_elasticache/cluster_utils.py renamed to django_elastipymemcache/cluster_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
5050
return {
5151
'version': version,
5252
'nodes': [
53-
'{}:{}'.format(smart_text(host),
54-
smart_text(port))
53+
(smart_text(host), int(port))
5554
]
5655
}
5756

@@ -67,8 +66,7 @@ def get_cluster_info(host, port, ignore_cluster_errors=False):
6766
try:
6867
for node in ls[2].split(b' '):
6968
host, ip, port = node.split(b'|')
70-
nodes.append('{}:{}'.format(smart_text(ip or host),
71-
smart_text(port)))
69+
nodes.append((smart_text(ip or host), int(port)))
7270
except ValueError:
7371
raise WrongProtocolData(cmd, res)
7472
return {

0 commit comments

Comments
 (0)