add LRU cache and max size setting to relay to fix memory leak