added cache check for max item size
other improvements in the cache api