Add new cache and RS2 handling

The new cache handling resudces the number of write requests to the cach
file. The modified RS2 handling reduces the attack window.
Merge branch 'newCache'