Monday, December 22, 2014

Re: Raw access to cache table

Hi Colin,

> Den 21/12/2014 kl. 05.55 skrev Collin Anderson <cmawebsite@gmail.com>:
>
> If you want a nicer interface, I just ran manage.py inspecdb on one of my databases and got this for the cache table. Not sure why django still does it by hand.
>
> class Cache(models.Model):
> cache_key = models.CharField(primary_key=True, max_length=255)
> value = models.TextField()
> expires = models.DateTimeField()
>
> class Meta:
> managed = False
> db_table = 'cache_table'

Thanks, that's actually a nice trick. I'd still need to un-pickle the values, but I can use the ORM to query cache_key.

Erik

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/F3C4ED56-811D-46EB-83D4-B76E0A252B40%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment