Skip to content

insert_new not compatible ConCache.Item #84

@thoughtarray

Description

@thoughtarray

As far as I can tell, insert_new isn't compatible with ConCache.Item. I discovered this when trying to use update, but the differences are visible when simply using get:

iex> ConCache.start_link(name: :my_cache, ttl_check_interval: :timer.seconds(1), global_ttl: :timer.hours(1))
{:ok, #PID<...>}

iex> item = %ConCache.Item{ttl: :timer.seconds(60), value: %{a: 1, b: 2}}
%ConCache.Item{value: %{a: 1, b: 2}, ttl: 60000}

iex> ConCache.put :my_cache, 1, item
:ok

iex> ConCache.get :my_cache, 1
%{a: 1, b: 2}

iex> ConCache.insert_new :my_cache, 2, item
:ok

iex> ConCache.get :my_cache, 2
%ConCache.Item{value: %{a: 1, b: 2}, ttl: 60000}

Both have the same arguments in the spec arg types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions