User tests: Successful: Unsuccessful:
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
Apply that PR and check whether cache works as before.
Method get / store have additional parameter $rawData
.
$rawData
is true then store
method accept unserialized $data
.$rawData
is true then get
method returns unserialized data.Category | ⇒ | Libraries |
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
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.
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).
Yes some additional test and documentations will be required.
For me it takes longer than write that code:)
@csthomas is this still live or can it be closed - its been quite some time since your last comment
Category | Libraries | ⇒ | Libraries Unit Tests |
Labels |
Added:
?
|
Title |
|
Title |
|
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.
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
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).
I close it
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-06-29 21:55:25 |
Closed_By | ⇒ | csthomas |
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.