Error with Django Cache

0

I'm trying to generate a cache with Django cache. According to the configuration, I need to program something like that.

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': 'unix:/cache/memcached.sock',
    }
}

After as I only want to generate a cache to a part of my model, I program a small function that generates a cache only to my products.

def cache_productos():
    valor = cache.get('productos')
    if not valor:
        print('no debera estar entrando')
        valor = Producto.objects.all()
        cache.set('productos', valor, 3600)
    return valor

This returns this error to me

  

module 'socket' has no attribute 'AF_UNIX'

If I delete the unix of the url it does not create the cache, it always returns None and it returns the queryset that it queries.

    
asked by F Delgado 27.06.2018 в 17:18
source

0 answers