#pragma once #include "lib/domain_model/Security.pb.h" #include "MDConsumerHandle.h" #include "lib/domain_model/SecurityKey.h" #include "SecurityPtr.h" #include namespace bts { namespace md { // Get security on demand // Store security+handle struct SecurityCacheImpl; class SecurityCache { std::shared_ptr _me; public: SecurityCache(); ~SecurityCache(); //Load security from cache with fallback to database SecurityPtr get_security(SecurityKey key); // Get the security if it's in the cache otherwise return nullptr. Does not query security database. SecurityPtr try_get_security(SecurityKey key) const; // returns true if the cache was updated bool add_live_security(const SecurityPtr& security); SecurityPtr add_db_security(const SecurityPtr& security); void flush_to_disk(); }; }}//ns