I set up johnny cache with one of my applications, which is hosted on apache. It is configured with memcached as a backend that runs on the same computer on the default port.
Caching works great when multiple web clients go through apache. They are all read from the cache, and any update invalidates the cache. But when the python / script program reads from the database using django (the same settings.py file that has the johnny configuration), it does not read from the cache, and therefore any updates made by this program will not affect the cache. This leaves me with web clients that read obsolete data from the cache.
I did not find anything in the johnny caching documentation related to this. Any thoughts on this situation?
I am using johnny cache 0.3.3, django 1.2.5 and python 2.7.
Edit:
to respond to one of the comments in the comments, I read from the DB in the script like this -
>>> cmp = MyModelClass.objects.get(id=1)
>>> cmp.cust_field_2
u'aaaa'
I know that it cannot be read from the cache, because I update the table directly by running the sql update statement, and the updated value is not reflected in my web client, since it is still read from the cache. While my script shows the updated value when I re-retrieve the object using MyModelClass.objects.get (id = 1)
Thank,
source
share