? ? Success

User tests: Successful: Unsuccessful:

avatar csthomas
csthomas
23 Aug 2016

Summary of Changes

Move functions serialize() and unserialize() from cache controllers files to cache storages.
Add method public function supportRawData() to storage.php

For B/C serialize/unserialize exists in JCache too.

From now everyone can add additional storage (adapter) which can use other functions to serialize and unserialize or not use it at all if not needed, ex opcache.

Storages would use own function to serialize, ex: igbinary_serialize, igbinary_unserialize

Testing Instructions

Apply that PR and check whether cache works as before.

Documentation Changes Required

Method get / store have additional parameter $rawData.

  • If $rawData is true then store method accept unserialized $data.
  • If $rawData is true then get method returns unserialized data.
avatar joomla-cms-bot joomla-cms-bot - change - 23 Aug 2016
Category Libraries
avatar csthomas csthomas - open - 23 Aug 2016
avatar csthomas csthomas - change - 23 Aug 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 23 Aug 2016
Labels Added: ?
avatar csthomas csthomas - change - 23 Aug 2016
The description was changed
avatar csthomas csthomas - edited - 23 Aug 2016
avatar csthomas csthomas - edited - 23 Aug 2016
avatar mbabker
mbabker - comment - 23 Aug 2016

At first glance this doesn't look B/C as you're changing the types of data being passed as parameters into some methods and changing the return types in other methods (i.e. JCacheController::get() won't unserialize data now). You're also not updating any of the method documentation; with this change you're injecting objects into places that are expecting strings which would fail massively if we had scalar typehinting. This would also presumably need new test cases to validate the behaviors of the individual components of the API, not just that you're introducing new logic in the controllers and JCache itself mitigates any potential changes.

avatar csthomas
csthomas - comment - 23 Aug 2016

At first glance this doesn't look B/C

If someone has own custom cache controller then B/C should be ok, but serialize run twice.

i.e. JCacheController::get() won't unserialize data now).

This is unserialize earlier in JCache class.

You're also not updating any of the method documentation

Yes this is missing.

This would also presumably need new test cases to validate the behaviors of the individual components of the API

I only move serialize to other (low level) place.
Serialize should not be related with JCacheController but more with JCacheStorage.
For B/C I moved it to JCache and check result of supportRawData().

All current storages does not have implemented supportRawData() and return false then there should not be any difference.

avatar csthomas csthomas - edited - 23 Aug 2016
avatar mbabker
mbabker - comment - 23 Aug 2016

All current storages does not have implemented supportRawData() and return false then there should not be any difference.

Right now, no. But right now you're opening the door to state that one day in the future the adapters MAY support objects after this pull request is merged. Therefore I think we need to ensure our adapters will handle cases where objects may slip in (remember none of the API is marked internal and there is a public factory to direct retrieve the adapters and completely bypass JCache or the controllers, so it's 100% fair game for someone to put their own caching API in front of our adapters).

Either way I still think the controllers and JCache itself should get an updated test case where it validates the potential new behavior. And maybe even a stub storage adapter in the test suite that does allow direct object injection to specifically validate that portion of the API works (right now it's all false so existing behavior should be retained but if someone creates a custom adapter that allows objects we need to stand confident in our API that it'll be supported).

avatar csthomas
csthomas - comment - 23 Aug 2016

Yes some additional test and documentations will be required.
For me it takes longer than write that code:)

avatar csthomas csthomas - change - 24 Aug 2016
The description was changed
avatar csthomas csthomas - edited - 24 Aug 2016
avatar csthomas csthomas - edited - 24 Aug 2016
avatar brianteeman
brianteeman - comment - 9 Dec 2016

@csthomas is this still live or can it be closed - its been quite some time since your last comment


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/11758.

avatar csthomas csthomas - change - 9 Dec 2016
The description was changed
avatar joomla-cms-bot joomla-cms-bot - change - 9 Dec 2016
Category Libraries Libraries Unit Tests
avatar csthomas csthomas - change - 10 Dec 2016
Labels Added: ?
avatar csthomas csthomas - change - 10 Dec 2016
The description was changed
avatar csthomas csthomas - edited - 10 Dec 2016
avatar csthomas csthomas - change - 10 Dec 2016
Title
[cache] Add support for storages that can store raw data (unserialized)
[cache] Move serialization from JCacheController to JCacheStorage subclasses
avatar csthomas csthomas - edited - 10 Dec 2016
avatar csthomas csthomas - change - 10 Dec 2016
Title
[cache] Add support for storages that can store raw data (unserialized)
[cache] Move serialization from JCacheController to JCacheStorage subclasses
avatar csthomas csthomas - change - 8 Feb 2017
The description was changed
avatar csthomas csthomas - edited - 8 Feb 2017
avatar csthomas
csthomas - comment - 15 Feb 2017

@mbabker What do you think about this PR?
I have added unit tests for available joomla storages and for 3rd party storage which does not support raw data.

Now $rawData for B/C by default is false, but all joomla cache controllers use $rawData=true.

avatar mbabker
mbabker - comment - 30 May 2017

This and #16307 are going to collide. We can add features to our Framework package if need be, but based on the two caching PSR interfaces, we can't rely on certain functionality we already have (i.e. locking) without losing the interoperability using a greater PHP standard would give.

avatar csthomas
csthomas - comment - 30 May 2017

I took a look only a few minutes but I saw that your PR has a serialize/unserialize functions in adapters (explicitly in File). That was my idea but I tried to do that in staging and because of B/C I did it in more complex way.

https://github.com/joomla/joomla-cms/pull/16307/files#diff-63a9b83d6fde7ce6d33ee990cf2c649cR126

avatar mbabker
mbabker - comment - 30 May 2017

The filesystem adapter is serializing since it has to handle writing the data on its own. For the rest of the adapters though, we're just pushing the data (in whatever source it's given) to the storage API without any type of processing (so we're letting APCu as an example figure out if it needs to serialize or do whatever internally).

avatar csthomas
csthomas - comment - 29 Jun 2017

I close it

avatar csthomas csthomas - change - 29 Jun 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-06-29 21:55:25
Closed_By csthomas
avatar csthomas csthomas - close - 29 Jun 2017

Add a Comment

Login with GitHub to post a comment