anchor.diff:              end
           end, {#{}, 1000000}, ToExpire),
   
  -    Max = application:get_env(?CLUSTER_WORKER_APP_NAME, max_key_tp_mem, 100),
       Exclude = maps:keys(CachedKeys) ++ maps:keys(KiF) ++ maps:keys(ToExpire2),
       ToInactivate2 = maps:without(Exclude, ToInactivate),
       ExcludeMap = maps:with(Exclude, ToInactivate),
   
  -    {State2, ExpireMaxTime3} = case maps:size(ToInactivate) > Max of
  -        true ->
  -            datastore_cache:inactivate(ToInactivate2),
  -            {State#state{keys_to_inactivate = ExcludeMap,
  -                keys_times = maps:with(Exclude, KeysTimes),
  -                flush_times = maps:with(Exclude, FT)}, ExpireMaxTime};
  -        _ ->
  -            MaxTime = application:get_env(?CLUSTER_WORKER_APP_NAME,
  -                tp_active_mem_sek, 5),
  -            MaxTimeUS = timer:seconds(MaxTime) * 1000,
  -
  -            ToInactivate3 = maps:filter(fun(K, _V) ->
  -                KeyTime = maps:get(K, KeysTimes, {0,0,0}),
  -                timer:now_diff(Now, KeyTime) > MaxTimeUS
  -            end, ToInactivate2),
  -
  -            ExcludeMap2 = maps:without(maps:keys(ToInactivate3), ToInactivate2),
  -            ExpireMaxTime2 = case maps:size(ExcludeMap2) of
  -                0 -> ExpireMaxTime;
  -                _ -> max(ExpireMaxTime, MaxTimeUS)
  -            end,
  -
  -            datastore_cache:inactivate(ToInactivate3),
  -            NewToInactivate = maps:merge(ExcludeMap, ExcludeMap2),
  -            NewToInactivateKeys = maps:keys(NewToInactivate),
  -            {State#state{keys_to_inactivate = NewToInactivate,
  -                keys_times = maps:with(NewToInactivateKeys, KeysTimes),
  -                flush_times = maps:with(NewToInactivateKeys, FT)}, ExpireMaxTime2}
  -    end,
  +    datastore_cache:inactivate(ToInactivate2),
  +    State2 = State#state{keys_to_inactivate = ExcludeMap,
  +        flush_times = maps:with(Exclude, FT)},
   
       MaxLinkTime = application:get_env(?CLUSTER_WORKER_APP_NAME,
           fold_cache_timeout, timer:seconds(30)),
  
positive.code: -spec handle_requests(list(), state()) -> state().
  handle_requests(Requests, State = #state{
      cached_keys_to_flush = CachedKeys,
      keys_times = KeysTimes,
      master_pid = Pid,
      link_tokens = LT
  }) ->
  
negative.code:         true ->
              State2#state{link_tokens = LT2, keys_to_expire = ToExpire2};
          _ ->
              Timer = erlang:send_after(ExpireMaxTime div 1000, self(), inactivate),
              State2#state{link_tokens = LT2, keys_to_expire = ToExpire2, inactivate_timer = Timer}
      end.
  
  