-
Notifications
You must be signed in to change notification settings - Fork 594
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
Offer migration path from Spray Caching #213
Comments
Yes exactly - shouldn't be hard I think, and I think it should live outside of the akka/akka repo, but we can host it under the |
BTW, why a new project? Is it a planned repo to hold all extra directives? |
It does not quite fit nor would it be "driven by" lightbend, so a separate repo makes most sense. |
Great, looking forward to the plan. |
https://github.com/ben-manes/caffeine/ |
|
Thanks @hepin1989. Please do prefer Caffeine. I no longer actively develop |
@zhxiaogg I assume you were not able to pick this up? |
@ktoso, Had a quick look at this, Caffeine is It's not a big deal - Caffeine's BoundedLocalCache looks like the way to go. |
@ianclegg can you use |
Because there hasn't been a justification for |
@ben-manes Perfect 👍 |
You may also prefer to use the Scala wrapper - Scaffeine, which provides a nice idiomatic view. |
Hi there! Thanks for chiming in @ben-manes :-) I think we'd actually prefer to depend on the raw java library - makes it easier to cross publish for different scala versions as we're not dependent on a 3rd party library then. Akka is kind of at the root of the tree of many dependencies so we try to publish for stable scala versions ASAP, so while it won't matter for a year or so it'll be nicer to depend on the raw java lib (also, since we hide the API behind directives anyway, users won't see much of the Caffeine API I think). Sounds like you're interested in hacking on this @ianclegg? That would be really great! Let us know if you need any hints etc. |
Sure, I have all the key pieces - i'll put together a PR - perhaps this evening - otherwise towards the end of the week and we can refine. |
@ktoso Earlier in this issue you mentioned creating a new repo for caching - whats your current thoughts on this? I noticed the unusual version number bump for akka-http 😏 should the cache/PR now sit in this repo. We'll have around 3 or so source files consisting of the cache directive, the cache trait and the cache implementations to find a home for. |
Thea earlier note on separate repo was indeed before we worked out the new versioning and split of akka-http into its own repo. Now it should be fine to include here, as separate project but in the same repo. We'd mark it as an experimental module. Thanks in advance :) |
@ben-manes Spray caching also wrapped the Off the top of your head, is going via To give you the background, although Spray Caching wraps them, they are not actually required by the Caching Directive, so there may be an option to simply drop them from the wrapper if the gist: https://gist.github.com/ianclegg/dc1254a77f815df64ffe2636696df4f2 |
The The write performance actually increased in Caffeine compared to CLHM, which can be a bit surprising. CLHM relies on spin loops to make the operations atomic whereas Caffeine synchronizes on the entry. But I wouldn't expect the benchmarked difference to be observable in real applications. Caffeine uses JDK8's rewritten CHM which is a big improvement. CLHM adopted a backport of that, but is loosely coupled so it worked with any I don't think there's any degradation except for the We could make async caches more flexible, as I error'd on simplicity to observe usages. |
Sounds like we shouldn't have a problem to continue supporting the spray Cache trait using those wrappers then. As I mentioned the remove method won't be used by the Cache Directive anyway, I think it was just there to enable the cache to be used in applications outside of Spray. Thanks again! |
Hi there - are you still working on this @ianclegg? |
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name Increase delay in cache test ApiMayChange annotation Remove test that sometimes fails due to race condition Exclude akka-http-caching from MiMa previous artifacts Remove the need for a loader on LfuCache creation Simplify CachingDirectives - remove CacheSpecMagnet MiMa ignoredModules Refactor LfuCache - replace subclasses with store param
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name Increase delay in cache test @ApiMayChange annotations Remove test that sometimes fails due to race condition Exclude akka-http-caching from MiMa previous artifacts Remove the need for a loader on LfuCache creation Simplify CachingDirectives - remove CacheSpecMagnet MiMa ignoredModules Refactor LfuCache - replace subclasses with store param Docs and example code for caching directives Move LfuCache params to LfuCacheSettings to support binary compatibility Replace Keyed and ValueMagnet classes with overloaded apply and get methods Remove default value for keyer function Remove build.sbt Update docs Make cache key type generic Fix Cache.remove comment WIP towards JavaDSL for akka-http-caching Use JavaMapping formatting copyright, docs, annotations Make CacheJavaMapping internal Java API markers getStrict -> getOrCreateStrict Remove simpleKeyer Use LfuCacheSettings in routeCache Example keyer for docs Fix for sbt 1.0 Make Java DSL implement proper CachingSettings companion =cache make settings reference.conf and mark things as internal
* Migrate Spray caching as akka-http-caching #213 Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name Increase delay in cache test @ApiMayChange annotations Remove test that sometimes fails due to race condition Exclude akka-http-caching from MiMa previous artifacts Remove the need for a loader on LfuCache creation Simplify CachingDirectives - remove CacheSpecMagnet MiMa ignoredModules Refactor LfuCache - replace subclasses with store param Docs and example code for caching directives Move LfuCache params to LfuCacheSettings to support binary compatibility Replace Keyed and ValueMagnet classes with overloaded apply and get methods Remove default value for keyer function Remove build.sbt Update docs Make cache key type generic Fix Cache.remove comment WIP towards JavaDSL for akka-http-caching Use JavaMapping formatting copyright, docs, annotations Make CacheJavaMapping internal Java API markers getStrict -> getOrCreateStrict Remove simpleKeyer Use LfuCacheSettings in routeCache Example keyer for docs Fix for sbt 1.0 Make Java DSL implement proper CachingSettings companion =cache make settings reference.conf and mark things as internal * Documentation, tests and various cleanups for caching =doc Add server-side overview page (#1371) Revert formatting changes back to how Scalariform formats Mark more settings constructors private Use self reference to implement with... methods Override productPrefix in the setting implementations Fix implementation of withLfuCacheSettings Implement withLfuCacheSettings in the Java DSL and provide a Scala-specific implementation as well. Fix compilation error in the caching directive example Fix places where the Java DSL leaks into the Scala DSL For example apply methods should always take the Scala DSL instance where as create methods should take the Java DSL instances. Caching docs (#6) * Fix use of fragments and IDs in directives * Add Java caching directives examples * Document Java caching directives * Document the caching design and implementation Port spray-caching documentation and update to the new caching API. * Document the akka-http-caching reference config * Fix reference to Java DSL cache * Fix another Cache reference * Reword docs related to the LFU cache * cleaning up paradox links
Rename to Lfu Make remove return Unit Move caffeine dependency to Dependencies.scala Fix CachingDirectives package name Increase delay in cache test @ApiMayChange annotations Remove test that sometimes fails due to race condition Exclude akka-http-caching from MiMa previous artifacts Remove the need for a loader on LfuCache creation Simplify CachingDirectives - remove CacheSpecMagnet MiMa ignoredModules Refactor LfuCache - replace subclasses with store param Docs and example code for caching directives Move LfuCache params to LfuCacheSettings to support binary compatibility Replace Keyed and ValueMagnet classes with overloaded apply and get methods Remove default value for keyer function Remove build.sbt Update docs Make cache key type generic Fix Cache.remove comment WIP towards JavaDSL for akka-http-caching Use JavaMapping formatting copyright, docs, annotations Make CacheJavaMapping internal Java API markers getStrict -> getOrCreateStrict Remove simpleKeyer Use LfuCacheSettings in routeCache Example keyer for docs Fix for sbt 1.0 Make Java DSL implement proper CachingSettings companion =cache make settings reference.conf and mark things as internal
Wednesday Jun 01, 2016 at 09:15 GMT
Originally opened as akka/akka#20679
The question keeps coming up, and it's only one simple file https://github.com/spray/spray/tree/master/spray-caching/src/main/scala/spray/caching
We could provide it as separate mini project, declare it community lead.
Please ping me if you'd like to contribute this port so I can create a repo for it.
The text was updated successfully, but these errors were encountered: