Refactor memory cache pruning
Version 0.4.1