I am currently writing a cache wrapper which will read the config and return what is the cache type (redis/memecache)
Now I have redis.go
and memcache.go
which has functions like
initialize(), getCache(), setCache()
My cache wrapper is my entry point and it returns
Redis or Memcache as a "string"
as output. Now I want to call the initialize function of either redis/ memcache depending on the string. How do I do it?
I want to make sure that the implementation of this cache wrapper is so generic that, even if I add another cache type (eg: aerospike) tomorrow and I should not even be the changing the cache wrapper file.
It should be independent of how many and the kind of variants that I have for doing the cache.