-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more details to migration guide (#6865)
1. How to update play and sbt 2. Changes to cache apis 3. Better order of migration steps 4. Better markup for code examples 5. Details about removed APIs
- Loading branch information
1 parent
024157a
commit 7ca95c3
Showing
4 changed files
with
171 additions
and
47 deletions.
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
documentation/manual/releases/release26/migration26/CacheMigration26.md
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,65 @@ | ||
# Cache APIs Migration | ||
|
||
## Removed APIs | ||
|
||
The deprecated Java class `play.cache.Cache` was removed and you now must inject an `play.cache.SyncCacheApi` or `play.cache.AsyncCacheApi`. | ||
|
||
## New Sync and Async Cache APIs | ||
|
||
The Cache API has been rewritten to have a synchronous and an asynchronous version. The old APIs will still work but they are now deprecated. | ||
|
||
### Java API | ||
|
||
The interface `play.cache.CacheApi` is now deprecated and should be replaced by `play.cache.SyncCacheApi` or `play.cache.AsyncCacheApi`. | ||
|
||
To use, `play.cache.SyncCacheApi` just inject it: | ||
|
||
```java | ||
public class SomeController extends Controller { | ||
|
||
private SyncCacheApi cacheApi; | ||
|
||
@Inject | ||
public SomeController(SyncCacheApi cacheApi) { | ||
this.cacheApi = cacheApi; | ||
} | ||
} | ||
``` | ||
|
||
And then there is the asynchronous version of the API: | ||
|
||
```java | ||
public class SomeController extends Controller { | ||
|
||
private AsyncCacheApi cacheApi; | ||
|
||
@Inject | ||
public SomeController(AsyncCacheApi cacheApi) { | ||
this.cacheApi = cacheApi; | ||
} | ||
} | ||
``` | ||
|
||
See more details about how to use both APIs at [[specific documentation|JavaCache]]. | ||
|
||
### Scala API | ||
|
||
The trait `play.api.cache.CacheApi` is now deprecated and should be replaced by `play.api.cache.SyncCacheApi` or `play.api.cache.AsyncCacheApi`. | ||
|
||
To use `play.api.cache.SyncCacheApi`, just inject it: | ||
|
||
```scala | ||
class Application @Inject() (cache: SyncCacheApi) extends Controller { | ||
|
||
} | ||
``` | ||
|
||
Basically the same for `play.api.cache.AsyncCacheApi`: | ||
|
||
```scala | ||
class Application @Inject() (cache: AsyncCacheApi) extends Controller { | ||
|
||
} | ||
``` | ||
|
||
See more details about how to use both APIs at [[specific documentation|ScalaCache]]. |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
Migration26:Migration Guide | ||
MessagesMigration26:Messages Migration | ||
WSMigration26:WS Migration | ||
WSMigration26:WS Migration | ||
CacheMigration26:Cache Migration | ||
JPAMigration26:JPA Migration |