o.c.sds.history: code refactoring of cache logic