Esempio n. 1
0
def do_pickle():
    pickle.dumps(posts, -1)
Esempio n. 2
0
from cacheops import invalidate_obj, invalidate_model
from cacheops.redis import redis_client
from cacheops.cross import pickle
from cacheops.tree import dnfs

from .models import Category, Post, Extra


posts = list(Post.objects.cache().all())
posts_pickle = pickle.dumps(posts, -1)

def do_pickle():
    pickle.dumps(posts, -1)

def do_unpickle():
    pickle.loads(posts_pickle)


get_key = Category.objects.filter(pk=1).order_by()._cache_key()
def invalidate_get():
    redis_client.delete(get_key)

def do_get():
    Category.objects.cache().get(pk=1)

def do_get_nocache():
    Category.objects.nocache().get(pk=1)


c = Category.objects.first()
def invalidate_count():