Skip to content

Remove :read and :write commands in favour of :commit tuples #430

Description

@whitfin

With the addition of supporting :commit syntax in commands for :write, it has become a little bit redundant to differentiate between :read and :write commands at all.

We should consider removing the different types of commands and instead just attach functions directly to a cache. This does make :read commands a little more annoying to build; but maybe we can do something like this if we think it's worth it:

def reader(fun) do
  fn value ->
    {:ignore, fun.(value)}
  end
end

Cachex.start_link(:my_cache, [
  commands: [
    last: reader(&List.last/1)
  ]
])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions