extract readCacheSize function.