anchor.diff:    {stop, Reason :: term()} | ignore).
   init([]) ->
     em_logger:info("Init positions manager"),
  -  Cache = ets:new(positions, [set, private, {keypos, 2}]),
  +  Cache = ets:new(positions, [set, private, {keypos, 8}]),
     {ok, Items} = em_storage:get_devices(),
     lists:foreach(fun(#device{id = DeviceId, positionId = PositionId}) ->
       case em_storage:get_last_position(PositionId, DeviceId) of
  
positive.code: %%%===================================================================
  %%% API
  %%%===================================================================
  
  %%--------------------------------------------------------------------
  %% @doc
  %% Starts the server
  
negative.code: %%%===================================================================
  %%% Internal functions
  %%%===================================================================
  do_get_positions(State = #state{cache = Cache}) ->
    {reply, {ok, ets:tab2list(Cache)}, State}.
  
  do_get_last_position(State = #state{cache = Cache}, SearchPositionId, SearchDeviceId) ->
    Match = ets:fun2ms(fun(Position = #position{id = Id, deviceId = DeviceId}) when (Id =:= SearchPositionId) and (DeviceId =:= SearchDeviceId) -> Position end),
    {reply, {ok, ets:select(Cache, Match)}, State}.
  
  do_create_position(State = #state{cache = Cache}, PositionModel) ->
    case em_storage:create_position(PositionModel) of
      {ok, Position} ->
        case ets:insert(Cache, Position) of
          true ->
            {reply, {ok, Position}, State};
          false ->
            {reply, {error, <<"Error sync in positions cache">>}, State}
        end;
      Reason ->
        {reply, Reason, State}
    end.
  