anchor.diff:          ]).
   
   -define(NO_CACHE_ORGS_KEY, <<",,NO_CACHE_ORGS">>).
  +%% Estimate this value by looking at db perc90 times for search requests. No sense waiting
  +%% on a cache for any longer than it would have taken you to go direct to the data.
  +-define(REDIS_CALL_TIMEOUT, 200).
   
   %% @doc Fetch an entry from the search cache.
  --spec get(_, {binary(), binary()}) -> not_found | {integer(), binary()}.
  +-spec get(_, {binary(), binary()}) -> not_found | {integer(), binary()} | error.
   get(ReqId, {OrgName, _} = Key) ->
       folsom_metrics:notify({search_cache_get, 1}),
       Redis = redis_client(),
  
positive.code:     Gzip = zlib:gzip(Raw),
      Value = term_to_binary({Count, Gzip}),
      Cmd = ["SETEX", key_to_bin(Key), integer_to_list(cache_entry_ttl()), Value],
      Fun = fun() -> eredis:q(Redis, Cmd) end,
      case folsom_time(search_cache_redis_set, Fun) of
          {ok, <<"OK">>} ->
              ok;
  
negative.code:             folsom_metrics:notify({search_cache_error, 1}),
              no_cache
      end.
  
  make_eredis_fun(Redis, Cmd) when is_list(Cmd) ->
      fun() ->
              %% Under load we are seeing gen_server timeout errors of unknown origin. Until
              %% we identify the root cause, protect the caller from uncontrolled crashes and
              %% return error atom so that requests can fall-back to cache-miss behavior.
              try
                  eredis:q(Redis, Cmd, ?REDIS_CALL_TIMEOUT)
              catch
                  EType:Why ->
                      error_logger:error_report({EType, ?MODULE, Why, Redis, hd(Cmd)}),
                      error
              end
      end.
  