This repository has been archived by the owner on Jan 30, 2021. It is now read-only.
forked from playframework/play1
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customization of @CacheFor cache key playframework#1133
- Loading branch information
1 parent
5e564b5
commit 811a235
Showing
4 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package play.cache; | ||
|
||
import play.mvc.Http.Request; | ||
|
||
/** | ||
* Allow custom cache key to be used by applications. | ||
*/ | ||
public interface CacheKeyGenerator { | ||
public String generate(Request request); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package play.cache; | ||
|
||
import play.mvc.Http.Request; | ||
|
||
/** | ||
* The Default Cache Key Generator | ||
*/ | ||
public class DefaultCacheKeyGenerator implements CacheKeyGenerator { | ||
@Override | ||
public String generate(Request request) { | ||
return "urlcache:" + request.url + request.querystring; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters