Problem/Motivation

In #3021963: Add a way to clear only static cache a new EntityCacheEntityControllerInterface is introduced, allowing to reset only the entity controller's internal static cache, but that method is only available for core entity types, whereas most contrib types relies on the Entity-provided controllers.

Proposed resolution

Implement EntityCacheEntityControllerInterface in a fully backwards-compatible way: add the new ::resetStaticCache() method to EntityAPIController, but provide new classes formally implementing the new interface extending both EntityAPIController and EntityAPIControllerExportable in a file that's loaded only if the new interface is available. This way we don't have to introduce a dependency on the Entity Cache module and its versions.

Remaining tasks

  • Validate the prosed solution
  • Post a patch
  • Reviews

User interface changes

None

API changes

Only additions

Data model changes

None

Release notes snippet

A new method is available for entity cache-aware controllers to reset only static cache.

Comments

plach created an issue. See original summary.

plach’s picture

Assigned: plach » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.05 KB
catch’s picture

+++ b/includes/entity.entitycache_controller.inc
@@ -0,0 +1,13 @@
+<?php

Very minor nit but 7.x code standards still ask for an @file here I think.

+++ b/includes/entity.entitycache_controller.inc
@@ -0,0 +1,13 @@
+ * An entity controller supporting entity cache.

Should this cross-reference back to the methods / explain why the classes are empty? More or less duplicating the comment in the other file but would be more explanatory for people finding this file first.

plach’s picture

StatusFileSize
new1.07 KB
new2.38 KB

Fixed, thanks!

catch’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me now. I just committed the entitycache end of this (although the way this is written there's no strict dependency on it having landed or being in a tagged release etc.).