Permalink
Browse files

! routing: move `UserPassAuthenticator.cached` to `CachedUserPassAuth…

…enticator.apply`, fixes #352

Because `UserPassAuthenticator.cached` relies on a spray-caching Cache even code not using this method
(but simply other `UserPassAuthenticator` methods like `apply` or `fromConfig`) must have spray-caching
on the classpath in order to avoid a `bad symbolic reference` compiler error.
This patch moves the `cached` method into a dedicated object thereby freeing up `UserPassAuthenticator`
from the dependency on the spray-caching module.
  • Loading branch information...
sirthias committed Jul 2, 2013
1 parent ea3e689 commit 13260464d682f47f8cadd24fc5506057f86a0b3c
@@ -47,14 +47,16 @@ object UserPassAuthenticator {
}
}
}
+}
+object CachedUserPassAuthenticator {
/**
* Creates a wrapper around an UserPassAuthenticator providing authentication lookup caching using the given cache.
* Note that you need to manually add a dependency to the spray-caching module in order to be able to use this method.
*/
- def cached[T](inner: UserPassAuthenticator[T], cache: Cache[Option[T]] = LruCache[Option[T]]())(implicit ec: ExecutionContext): UserPassAuthenticator[T] =
+ def apply[T](inner: UserPassAuthenticator[T], cache: Cache[Option[T]] = LruCache[Option[T]]())(implicit ec: ExecutionContext): UserPassAuthenticator[T] =
userPassOption
cache(userPassOption) {
inner(userPassOption)
}
-}
+}

0 comments on commit 1326046

Please sign in to comment.