|
ClientCache implements an LRU cache and acts as the gatekeeper for logging client metadata for incoming gRPC streams. This ticket focuses on using the existing LRUCache to implement a thread-safe ClientCache, where:
- The constructor forwards the maximum cache size to the constructor of LRUCache. By default, we will set this to 65,536, reserving about 1 MB of memory for the cache.
- The add method inserts clientId into the underlying cache:
- If the clientId already exists, the cache is updated and the add method returns false.
- Otherwise, it returns true.
class ClientCache {
|
explicit ClientCache(size_t maxSize);
|
bool add(const UUID& clientId) = 0;
|
};
|
|