Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memoization of methods that return Futures #62

Merged
merged 5 commits into from
Sep 27, 2015
Merged

Memoization of methods that return Futures #62

merged 5 commits into from
Sep 27, 2015

Conversation

cb372
Copy link
Owner

@cb372 cb372 commented Sep 27, 2015

Fixes #59

Adds asynchronous versions of scalacache.caching, scalacache.cachingWithTTL and scalacache.memoization.memoize. These methods wrap an f: => Future[V] and return a Future[V].

This involves breaking API changes, as I took this opportunity to reorganise the API.

  • What was scalacache.caching is now called scalacache.sync.caching.
  • Same goes for scalacache.cachingWithTTL.
  • What was scalacache.memoization.memoize is now called scalacache.memoization.memoizeSync.
  • scalacache.getSync has been deprecated and replaced with scalacache.sync.get.

This is a breaking API change because the existing methods have been
renamed to `cachingSync` and `cachingSyncWithTTL`.

The opinionated stance of ScalaCache is that you should use the async
API and everything should be a Future. We also provide synchronous
counterparts as a convenience, but the methods get slightly uglier
names.
This is also a breaking change because the original methods have been
renamed to `memoizeSync`
Now they take the form of e.g. `sync.cachingWithTTL`, which is slightly
less ugly than `cachingSyncWithTTL`.

Unfortunately I couldn't follow this pattern for memoize, because you
end up with annoying ambiguous imports when you try to import both
`scalacache._` and then `memoization._`.
cb372 added a commit that referenced this pull request Sep 27, 2015
Memoization of methods that return Futures
@cb372 cb372 merged commit c71370c into master Sep 27, 2015
@cb372 cb372 deleted the memoize-futures branch September 27, 2015 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant