# handle_object class

## Summary

Class that provides read and write access to value in a `concurrent_lru_cache`.

## Syntax

    template <typename key_type,
     typename value_type,
     typename value_functor_type = value_type (*)(key_type) >
     class concurrent_lru_cache::handle_object {

## Header

    #include "tbb/concurrent_lru_cache.h"

## Description

A `handle_object` is a (smart handle) proxy object returned by the cache container allowing getting reference to the value.

Live object of this type prevents the container from erasing values while they are being used.

The `handle_object` does not have copy semantics; instead it only allows transfer of ownership i.e. it semantics is similar to one of `std::auto_ptr` or move semantics from C++11.

## Members and free standing functions

    namespace tbb {
     template <typename key_type,
     typename value_type,
     typename value_functor_type = value_type (*)(key_type) >
     class concurrent_lru_cache::handle_object {
     public:
     handle_object(handle_move_t m);
     operator handle_move_t();
     value_type& value();
     ~handle_object();
     private:
     void operator=(handle_object&);
     handle_object(handle_object &);
     };
    };
     handle_move_t move(handle_object& h);
     }

The following table provides additional information on the members of this template class.
Member | Description
--- | ---
handle_object(handle_move_t m) | Constructs an `handle_object` object from a pointer or from another `handle_object` (through implicit conversion to `handle_move_t` object). Since `handle_object` objects owns a reference to a value object of LRU cache, when a new `handle_object` is constructed from another `handle_object`, the former owner releases the reference ownership (i.e. no longer refers to any value) .
operator handle_move_t() | This method should not be called directly, instead use free standing `move` function. Effects: Transfer reference ownership from `handle_object` objects to temporary `handle_move_t` object. Returns: `handle_move_t` object pointing to the same value object of LRU cache
value_type& value() | Return a reference to value object of LRU cache container. Returns: Reference to `value_type` object inside the LRU cache container.
~handle_object() | Release a reference to value object of LRU cache container. It it was the last reference to the value object the container is allowed to evict the value.

Parent topic: concurrent_lru_cache Template Class