Use variable to store size instead of recalculating it every time

Use a variable to store the size, and update it, when an entry is added or deleted from the cache.