i want to cache my object in the memory for performance,but also need to recycle them if it's too long not accessed.
every 30 minutes a function would be called , check every cache object , like a file's attributes in windows operation system, each object should have two attributes:last modified time stamp(or a flag) and last accessed time stamp, if the last modified time is great than zero, create a sql for update them in datebase ,and reset the modified time to 0, if the last accessed time is larger than 30 minutes, then delete them from the cache system.
What is the best way to implement them?and is there already a similar system in python so i don't have to reinvent the wheel.
ps. no Memcached. the object should be accessed directly, no serialization and deserialization .