remove duplicate functions
added 3 config parameters for controlling cache TTL
minor: cleanup