generate a store from a cache
remove duplication using boilerplate