small refactor
add cache invalidation support and use db. fix #14