Refactoring garbage collector to use cache API instead of server context