Caches objects of type T that are bound to an EventBase from the global IOExecutor.
Synopsis
Declared in <folly/executors/IOObjectCache.h>
template<class T>
class IOObjectCache;
Description
Provide a factory that creates T objects given an EventBase, and get() will lazily create T objects based on an EventBase from the global IOExecutor. These are stored thread locally: for a given pair of event base and calling thread there will only be one T object created.
The primary use case is for managing objects that need to do async IO on an event base (e.g. thrift clients) that can be used outside the IO thread without much hassle. For instance, you could use this to manage Thrift clients that are only ever called from within other threads without the calling thread needing to know anything about the IO threads that the clients will do their work on.
Type Aliases
Name |
Description |
Factory that creates a T object bound to a given EventBase. |
Member Functions
Name |
Description |
|
Constructors |
Return the cached object for the current thread and IO event base. |
|
Set the factory used to create cached objects. |
Template Parameters
Name |
Description |
T |
The type of object cached per EventBase. |
Created with MrDocs