playframework / playframework/playframework

CacheBuilder is hard to use with ActionBuilder

Open
#6,382 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
12.6k
Forks
4k
Avg merge
2d 3h
Merged PRs (30d)
29

Description

Play Version (2.5.x / etc)

master

API (Scala / Java / Neither / Both)

Scala

Actual Behavior

play.api.cache.Cached uses a CachedBuilder which generates an EssentialAction rather than an Action

https://github.com/playframework/playframework/blob/master/framework/src/play-cache/src/main/scala/play/api/cache/Cached.scala#L118

This means that it's hard to use Cached in action composition, because composeAction takes an Action and not an EssentialAction:

https://github.com/playframework/playframework/blob/master/framework/src/play/src/main/scala/play/api/mvc/Action.scala#L450

It's not clear what the advantage is in returning EssentialAction, and I think this can be changed without consequence.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Cached.scala around line 118 and Action.scala around line 450 to trace the return type from CachedBuilder and the type expected by composeAction. Confirm whether changing the generated action type preserves the existing behavior; done means Cached can be used with composeAction without an EssentialAction mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
backend-api-design
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.