Changed CACHE_OK logic. Made it only work for memory cache instead of db.