put cache into a separate module

because we might want to use it from the frontend too