Template Struct shadow

Inheritance Relationships

Base Type

Struct Documentation

template<typename KeyT, typename ...T>
struct udho::cache::shadow : public udho::cache::flake<KeyT, T>

copiable shadow of a store reference.

user u("Neel");
appearence a("red");
udho::cache::store<std::string, user, appearence> store;
udho::cache::shadow<std::string, user, appearence> shadow_ua(store);
shadow_ua.insert("x", u);
shadow_ua.insert("x", a);
std::cout << std::boolalpha << shadow_ua.exists<user>("x") << std::endl; // true
std::cout << std::boolalpha << shadow_ua.exists<appearence>("x") << std::endl; // true
std::cout << shadow_ua.get<user>("x").name << std::endl; // Neel
std::cout << shadow_ua.get<appearence>("x").color << std::endl; // red
udho::cache::shadow<std::string, user> shadow_u(store); 
std::cout << std::boolalpha << shadow_u.exists<user>("x") << std::endl; // true
std::cout << std::boolalpha << shadow_u.get<user>("x").name << std::endl; // true
std::cout << shadow_u.exists<appearence>("x") << std::endl; // won't compile
udho::cache::shadow<std::string, user> shadow_u2(shadow_u); // copiable
udho::cache::shadow<std::string, user> shadow_u3(shadow_ua); // narrowable
udho::cache::shadow<std::string, appearence> shadow_a(store); // unordered
std::cout << shadow_a.exists<appearence>("x") << std::endl; // true
std::cout << shadow_a.get<appearence>("x").color << std::endl; // red
udho::cache::shadow<std::string> shadow_none(shadow_ua);

Public Types

typedef KeyT key_type
typedef shadow<key_type, T...> self_type
typedef self_type shadow_type
typedef master<key_type> master_type

Public Functions

template<template<typename, typename> class StorageT, typename ...X>
shadow(store<StorageT, key_type, X...> &store)
template<typename ...X>
shadow(shadow<key_type, X...> &other)
bool issued(const key_type &key) const
void issue(const key_type &key)
template<typename V>
bool exists(const key_type &key) const
template<typename V>
V at(const key_type &key) const
template<typename V>
V get(const key_type &key, const V &def = V()) const
template<typename V>
void set(const key_type &key, const V &value)
template<typename V>
void insert(const key_type &key, const V &value)
std::size_t size() const
template<typename V>
std::size_t size(const key_type &key) const
bool remove(const key_type &key)
template<typename V>
bool remove(const key_type &key)
boost::posix_time::ptime created(const key_type &key) const
boost::posix_time::ptime updated(const key_type &key) const
boost::posix_time::time_duration age(const key_type &key) const
boost::posix_time::time_duration idle(const key_type &key) const
template<typename V>
boost::posix_time::ptime created(const key_type &key) const
template<typename V>
boost::posix_time::ptime updated(const key_type &key) const
template<typename V>
boost::posix_time::time_duration age(const key_type &key) const
template<typename V>
boost::posix_time::time_duration idle(const key_type &key) const

Public Members

master_type &_master