fix set_cache bug
check object size before storing in cache