Implement cache trimming when user sets smaller soize of cache.