std::pair<std::shared_ptr<expire_info>,std::shared_ptr<T>> get_as_with_expire(const database_type & db, const std::string & key, const timeval_type & current) { std::pair<std::shared_ptr<expire_info>,std::shared_ptr<type_interface>> val = db.get_with_expire(key, current); if (!val.second) { return std::make_pair(std::shared_ptr<expire_info>(), std::shared_ptr<T>()); } std::shared_ptr<T> value = std::dynamic_pointer_cast<T>(val.second); if (!value) { throw std::runtime_error("ERR type mismatch"); } return std::make_pair(val.first, value); }