Skip to main content
# django-elephant

[![Build Status](https://travis-ci.org/jairhenrique/django-elephant.svg)](https://travis-ci.org/jairhenrique/django-elephant)
[![PyPI version](https://badge.fury.io/py/django-elephant.svg)](https://badge.fury.io/py/django-elephant)
[![codecov.io](https://codecov.io/github/jairhenrique/django-elephant/coverage.svg?branch=master)](https://codecov.io/github/jairhenrique/django-elephant?branch=master)
[![Code Issues](https://www.quantifiedcode.com/api/v1/project/03084631935244baa8335617d6502d11/badge.svg)](https://www.quantifiedcode.com/app/project/03084631935244baa8335617d6502d11)


*django-elephant is a simple wrapper to cache responses of Django methods or functions*


## Setup

```bash
pip install django-elephant
```

## Usage

#### Basic:

```python
from elephant import memorize

@memorize()
def foo(bar):
return bar
```


#### Set cache configuration:

```python
from django.core.cache import caches
from elephant import memorize

other_cache = caches['other_cache']

@memorize(
cache=other_cache
)
def foo(bar):
return bar
```


#### Set cache timeout:

```python
from elephant import memorize

@memorize(
timeout=1987
)
def foo(bar):
return bar
```

#### Set cache key:

```python
from elephant import memorize

def my_custom_key(function, *args, **kwargs):
return '{}.{}'.format(
'elephant_'
function.__name__
)

@memorize(
cache_key=my_custom_key
)
def foo(bar):
return bar
```

## Requirements
- Django>=1.5


## Contribute
- Fork and make a pull request!

Metadata

Release files for django-elephant 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-elephant 1.0.0
File Size Uploaded
django-elephant-1.0.0.tar.gz 5.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-elephant 1.0.0
File Interpreter ABI Platform
django_elephant-1.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.8 kB

Release files / django-elephant-1.0.0.tar.gz

Download URL django-elephant-1.0.0.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
003c4a5f2660556a417602a93108b5240b2a2b30aa95bcba8c1d081097510a9d
BLAKE2b-256 checksum
How to use checksums
fade899335080c19eaff39722830b1cb061c1e995b965ab13c52dc10b6b6b248
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / django_elephant-1.0.0-py2.py3-none-any.whl

Download URL django_elephant-1.0.0-py2.py3-none-any.whl
Size 4.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
9fb8c7babc19d65b75d884ee8bdfa8871cc64b98c68e15c96ff889ffe193345a
BLAKE2b-256 checksum
How to use checksums
5d7fc794639e4f5b77d769e48b082f94eb3febead030592db41571df9eff8536
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.0.2

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page