In order to disable caching, the cacheCloner should implement the Cloner interface. This makes it super simple to wrap the default cloner with caching, or without, while keeping the rest of the code the same. For example, if they implement the same interface, we can do this:
clone := cloner.NewDefault()
if nocache == false {
clone = cloner.NewCache(clone)
}
We can then add a --no-cache flag.
In order to disable caching, the
cacheClonershould implement theClonerinterface. This makes it super simple to wrap the default cloner with caching, or without, while keeping the rest of the code the same. For example, if they implement the same interface, we can do this:We can then add a
--no-cacheflag.