A draft for the local cache (not properly tested) and some tests