--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I would like to hear Robert's side of this story as well.
In the meantime, I have quickly coded up sample Doctrine Cache adapters that would work with each of these proposed interfaces in order to help us compare the two. See https://gist.github.com/jeremeamia/5105190. If you see anything incorrect in my gist, let me know.
Hi All,
Since this is just a straw poll, I'd urge everyone to hold off until Robert can respond in detail. I'd also suggest someone independent agree a new straw poll including agreed summaries from both sides - assuming they cannot reach a compromise proposal in the meantime.
I'm sure it was unintentional, but with Robert not being consulted beforehand and the poll being started by the proponent of one proposal, the risk of skewed results make this poll irrelevant.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/3Qs9COAWWs8J.
Back then, I've merged my proposal with Evert's and Beau Simensen provided some great input back then as well.
Now Paul tried to step in and merged all three of them as he saw fit and me, Beau, Larry Garfield (I think, I can't remember, it was way back into the night when we did it) helped out in ironing out inconsistencies in the interfaces.
I've did my fare share of input on Roberts proposal but so far he neither took the time to improve it or give good reasons why his proposal is truly better that anything else that we currently have. Others did the same. I hope this time he'll be able to provide feedback in the next days, as he said, and then we'll have a better image on this but consider that it would rather be good to start focusing on advantages / disadvantages on our (or better said, on your own - referring to voting members) and see this topic move along.
After having seen Evert's proposal again, I have some comments on it as well. Most notably I'm finding myself more and more in favor of a "cache item" approach. So I'll try to keep this constructive as suggesting "please do it with a cache item?" means you'd basically be either writing Florin's proposal or Rober's. Or even Spring's. So I won't go there, 'k? :)
I am going to ask the same thing that I ask of everything: how does the proposal match up with existing cache implementations in the member projects?
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/sEnA7gdTKGsJ.
I liked the idea of having two cache proposals passed, a simple cache and an advanced cache.
If we only get to choose one, I'd vote to choose the better advanced cache even if the member projects right now are largely using a far more simple solution. It will help encourage member projects and other people alike to be smarter about handling cache. I can easily see people choosing to vote for Evert's just out of simplicity, though.
I may have missed some discussion of this, but I think the
confirmation of the timezone of the Expiration was never really
specified and the spec might need to take this into account, possibly
by specifying that (as most likely expected), Expiration is expressed
as in the W3C Profile of ISO 8601. Or as seconds after the Epoch, or
whatever.
In the other proposal it was slightly more clear
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/9PO5uU6IvqkJ.
Hey,After a week of reviews, updates, patches to the proposal and it's related 'examples' files, I have issued the PR, which you can see here: https://github.com/php-fig/fig-standards/pull/96The proposal URL is here: https://github.com/dragoonis/fig-standards/blob/master/proposed/psr-cache.md
/**
* Remove an item from the cache by its unique key
*
* @param string $key The unique cache key of the item to remove
*
* @return CacheInterface Returns itself to support chaining.
*
* @throws \RuntimeException on error
*/
public function remove($key);
--
You received this message because you are subscribed to a topic in the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/php-fig/UkSWS48eEgo/unsubscribe?hl=en.
To unsubscribe from this group and all its topics, send an email to php-fig+u...@googlegroups.com.
/** * Persisting our data in the cache, uniquely referenced by a key with an optional expiration TTL time. * * @param string $key The key of the item to store * @param mixed $value The value of the item to store * @param null|integer $ttl Optional. The TTL value of this item. If no value is sent and the driver supports TTL * then the library may set a default value for it or let the driver take care of that. * * @return boolean */ public function set($key, $value, $ttl = null);2. The multiple set does not pass in keys.
CacheItem
, implementations will
guarantee consistency across
various systems and ensure that the user will always retrieve the
expected
data without performing any additional operations."CacheItem
objects are generated by the Cache
class. CacheItem
objects
encapsulate the key and value of the stored cache entry"Cache
MUST set a default
value that is either configured by the user or, if not available,
the maximum
value allowed by the cache system. If the cache system does not
support a TTL
option then the user specified and default TTL values will be
ignored."Two questions:
1. On the set method -- allow null for the $key since the cache class will likely create the key.
(I am okay with no $key for a set -- can live with a key, too, but it should at least allow null)/** * Persisting our data in the cache, uniquely referenced by a key with an optional expiration TTL time. * * @param string $key The key of the item to store * @param mixed $value The value of the item to store * @param null|integer $ttl Optional. The TTL value of this item. If no value is sent and the driver supports TTL * then the library may set a default value for it or let the driver take care of that. * * @return boolean */ public function set($key, $value, $ttl = null);
2. The multiple set does not pass in keys.
Does that make sense for those who want the multiple?
Should it be consistent between the single and multiple sets?
Thanks!
Section 1.3:
"By using theCacheItem
, implementations will guarantee consistency across various systems and ensure that the user will always retrieve the expected data without performing any additional operations."
This sentence makes no sense to me. Using an interface at all is intended to "guarantee consistency across various systems". There's nothing obvious in CacheItem itself that makes that statement true. Also, "without performing any additional operations" means... what? No new IO? No new method calls? The sentence is too generic for me to get any meaning from it.
"TheCacheItem
objects are generated by theCache
class.CacheItem
objects encapsulate the key and value of the stored cache entry"
This seems to imply that I as a consumer MUST NOT create CacheItem classes myself. True? If so, that should be made explicit.
Section 1.4:
"If the user does not provide a TTL value then theCache
MUST set a default value that is either configured by the user or, if not available, the maximum value allowed by the cache system. If the cache system does not support a TTL option then the user specified and default TTL values will be ignored."
Compound sentences make for holes in understanding. :-) How is a default configured? Also, "will be ignored" doesn't tell me anything as an implementer. It is more written as if I were documenting how my implementation works to a user of an implementation.
I would reword this paragraph as follows:
"Implementations MAY provide a mechanism for a user to specify a default TTL if one is not specified for a specific cache item. If no user-specified default is provided implementations MUST default to the maximum legal value allowed by the underlying implementation. If the underlying implementation does not support TTL, the user-specified TTL MUST be silently ignored."
I *think* that says the same thing, but is (I think) more precise and leaves less room for implementers to make incompatible assumptions.
Also, this line: "It will be the implementation's job to define what values are considered valid or invalid for key names or TTL values based on what the underlying driver can accept but the user MUST be aware of the accepted values for both the TTL values as well as for key names."
That tells me as a user that I can make no assumptions whatsoever about what a legal key value is, and I'm entirely at the mercy of a given implementation. That is, if a given implementation decided to only allow lower-case alphabetic keys up to 5 characters, that's spec-legal (even if a stupid implementation). TTLs are already handled in the previous paragraph, so should not be mentioned here. For keys, we should define at least a minimum baseline. I'd recommend mandating that all implementations MUST support, at minimum, unaccented alphanumeric characters plus underscore in mixed case up to 32 characters long, in UTF-8 encoding (or compatible, since what I just described is also basic ASCII). If a given implementation wants to also support full UTF-8 keys, or allow 64-character keys, or allow the infamous snowman character, cool. But I as a user should be able to rely on at least that common baseline of UTF-8 alphanumerics.
Section 2.1:
I thought we were leaning toward offering both isHit() and isMiss()? I'm fine either way with isMiss(), I don't much care, but I am surprised to not see it here after the previous thread.
Section 2.2:
The docblock for get() doesn't have a single-line opening. The line that begins "A CacheItem object" should be separated from it to aid docblock parsing. Also, "Here we pass in" sounds like a tutorial, not a documentation block. It should be instead a more typical "Returns a whatever" style statement. Any further description belongs in the longdesc of the comment. That applies to all methods in the specification.
Also, please ensure all sentences end with periods. Right now it's quite inconsistent throughout the document.
The description of $ttl on set() doesn't seem consistent with the text above. I would see the docblock more as aimed at a consumer reading a text-tip in their IDE, not as a restatement of the intended behavior for implementors. To that end, I'd suggest:
"The TTL value of this item, in seconds. If not specified, it will default to the longest legal value or a previously-user-specified default value."
While not strictly required, I do think it would be good to allow DateInterval objects here as well. It just feels subjectively more complete to allow *something* from PHP's fairly-well-developed date/time handling when talking about time.
We specify that getMultiple() must return a keyed array, which is good. Should we also mandate the same order as the original $keys array, or explicitly NOT require that? (We should do one or the other; I'd favor requiring it to match, but could see an argument either way as long as it's explicit.)
getMultiple($keys); // $keys should be type-hinted to array
The $ttl parameter for setMultiple() should be written in plural. Right now it's just a copy/paste of set(), so it reads awkwardly.
The various boolean returns are either not documented, or documented as "the result of the operation". That tells me nothing at all. If we're returning meaningful information, then it should be explicitly TRUE for a successful write or FALSE if the data could not be written. If not, we should return $this to allow chaining.
Which, actually, brings up an interesting question. Are there any exceptions we should be throwing here? If not, should we document that exceptions must NOT be thrown? Or that they MAY be thrown if the underlying implementation throws it? (Eg, a DB cache throwing a PDOException.) I'm not sure what the correct handling here is, but we should think through the failure conditions and how they should be treated so that implementers and clients can be consistent and know what to expect.
General thoughts:
On the whole I like this approach. However, based on my conversation with Beau, Robert, Paul, et al in IRC last week I do want to call out one thing that was not included in the proposal here, because I think it's the key to the "Florian's vs. Robert's" question.
In some earlier versions, there was also a setItem() method on the Cache interface. It accepted a CacheItem and a TTL, which in turn allowed for round-tripping of a CacheItem object.
The important point there is that if CacheItem can be independently instantiated, it is completely unbound from the Cache implementation. That means the CacheItem class is "dumb", and cannot contain any useful logic.
In Robert's version, the substantive distinction is that CacheItem is *not* created arbitrarily but instead spawned from the Cache object. In Robert's vision, that allowed the CacheItem to be "smart" and do lazy-loading, because it could contain a reference to either Cache or to the underlying engine (DB connection, Memcache object, watever.)
In Robert's proposal he then put the meaningful methods on the CacheItem interface (to actually retrieve data). However, if the CacheItem is spawned from the Cache object exclusively that is purely an API aesthetic question and not a change of functionality. (The lazy-load behavior could still be implemented either way, just hidden behind an interface exactly as it should be.) Personally I favor the general API model in the proposal on the floor now.
In the proposal in front of us, we have a CacheItem::setValue() method. That... doesn't do anything as far as I can tell. There is no Cache::setItem() method to accept a CacheItem to write, in which case the only way that CacheItem::setValue() would do anything is if it wrote back to the data store immediately. However, that only works if CacheItem has a reference to Cache... which if it's not spawned from Cache in the first place it cannot have! (Certainly not in a portable fashion.)
I believe there are two ways to address this problem.
1) Remove CacheItem::setValue(), and make CacheItem exclusively an immutable object returned by get()/getMultiple() for reading. Period. Make it clear that users will never be creating CacheItem objects themselves. This approach has the advantage of simplicity.
What this approach offers is extensibility. The current proposal (rightly, IMO) ignores more advanced questions such as tagging. However, it's not obvious to me how either we or some other implementer could add that in a backward compatible way. Modifying the method signature to set($key, $value, $ttl, $tags, $something_else) is clearly not workable.
Leveraging the CacheItem, though, makes that simple. If a given implementation supports tagging, it would do so ONLY on setItem(). Like so:
$item = $cache->createItem('foo');
$item
->setValue(something_expensive())
->addTag('bob');
$cache->setItem($item);
$cache->set('bar', whaever()); // No tags allowed
// Later
$cache->clearByTag('bob');
This particular implementation extends CacheItemInterface with TaggableCacheItemInterface, and TagAwareCacheInterface. It's completely backward compatible with non-tag-using code, however. And, because CacheItem is only ever spawned by Cache, it can guarantee that it doesn't get an incompatible cache object back. (Unless you have 2 cache implementations in place at once and pass an object back to the wrong one, in which case you are shooting yourself in the foot and it's not our problem.)
So my cache implementation can support all kinds of fanciness... on setItem() only. If I want to use a 3rd party library that only speaks basic PSR-Cache, it will still work transparently because that library doesn't even need to know that it could use tagging. It also means a PSR-Cache-Tagging spec would be just a few extensions to CacheItemInterface and CacheInterface, with no BC breakage.
I'm not suggesting we debate how to implement tagging or other features right now; However, given that we want to allow people to experiment and innovate on top of this model, and we want to be able to extend it ourselves in the future, I think building in the extra flexibility now to allow that to happen is worth the relatively modest extra effort now. (For implementers not doing anything fancy with setItem(), it's a single line of code to have it defer to set(). Trivial.)
The other differences with Robert's proposal come down to "where to put the method" (I like them where they are in this proposal) or implementation details (the aforementioned "item contains the cache engine" question) that by design should *not* be part of the spec. But the coupling of CacheItem to Cache is, I believe, valuable, and would allow both us and implementers far more leeway to experiment and extend in the future.
I apologise in advance if these questions have been asked already.1. CacheInterface::set returns a boolean. What would the difference be between true and false?
2. Is there a need to add a garbage collection like `clear` but it only clearing the expired cache items (more than one disk has filled up with a runaway cache)?
I'd also echo Larry's comment about CacheItem. Just thinking out loud, the following example be useful:$item = $cache->get('foo');if ($item->isMiss()) {$data = getDataMethod();$item->setValue('foo', $data, $ttl);} else {$data = $item->getValue();}// Use $dataCould even go as extreme as:$data = $cache->get('foo')->getValue($callback, $ttl);Where the $callback is a data-getter to populate 'foo' if it's a miss.
Regards,
Andrew Eddie
Just bouncing some ideas, we could have CallbackCacheItem::setMissCallback($callback) on the item instead which would be BC compatible as well.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
Thanks guys for all the replies, I read everything.Larry,These introductory paragraphs were taken from the proposals that existed previously.Could you or someone write up a revised copy of them that makes more sense and conforms to the interfaces listed?What's the bonus reasons for making the CacheItemInterface objects immutable? This restricts people from updating a cache item's value and sending it back for persistence. I don't believe it's hindering implementation in any way but making mutable values more flexible for people to consume into their existing caching systems. I'd definitely be interested in hearing why immutable objects would be a better approach here.
Andrew / Florin,I think an onMiss() method with a callback is valuable, but for our first proposal to get finalised and sent into the wild and most importantly learned lessons from, we could come back in a little while with the knowledge/experience gained and draft up a second caching PSR that builds on top of our first simple caching proposal.
Hi Paul,See below:
On Wednesday, March 13, 2013 2:40:43 PM UTC+2, Paul Dragoonis wrote:Thanks guys for all the replies, I read everything.Larry,These introductory paragraphs were taken from the proposals that existed previously.Could you or someone write up a revised copy of them that makes more sense and conforms to the interfaces listed?What's the bonus reasons for making the CacheItemInterface objects immutable? This restricts people from updating a cache item's value and sending it back for persistence. I don't believe it's hindering implementation in any way but making mutable values more flexible for people to consume into their existing caching systems. I'd definitely be interested in hearing why immutable objects would be a better approach here.Currently there's no method that accepts an item, CacheItem, back in the Cache, so at least for the moment a mutable object doesn't make sense.If we do allow for a model where the drivers can be injected into CacheItem and then the item does its magic, like in Robert proposal, then we'll need to have a setTtl() as well. I think this will complicate things unnecessarily for the moment.After cleaning up the texts in the specifications maybe it will make sense have a vote on this as well?
Andrew / Florin,I think an onMiss() method with a callback is valuable, but for our first proposal to get finalised and sent into the wild and most importantly learned lessons from, we could come back in a little while with the knowledge/experience gained and draft up a second caching PSR that builds on top of our first simple caching proposal.This is right, both me and Andrew were on the same page with this, lets first get the basic thing going, lets ensure it's future proof, like Larry said, there are a bunch of things to consider that we might add in the future and lets keep this in mind when we go to next step ;)
Best regards,FlorinI hope I covered everything.Cheers,PaulOn Wed, Mar 13, 2013 at 11:25 AM, Andrew Eddie <mamb...@gmail.com> wrote:
On 13 March 2013 20:27, Florin Patan <flori...@gmail.com> wrote:
Just bouncing some ideas, we could have CallbackCacheItem::setMissCallback($callback) on the item instead which would be BC compatible as well.Hrm.$data = $cache->get('foo')->onMiss($callback)->getValue();I'd be happy with that approach??
I would not hold this PSR up for it. There's no reason a PSR couldn't be proposed to address just *that* issue.Regards,Andrew Eddie--To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To post to this group, send email to php...@googlegroups.com.--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/qqot04i709QJ.
Hi all,Regarding the onMiss() and events/callbacks in general, I think it should not be in the scope of the spec. An implementation could mix in an event dispatcher (ex. Événement or some future PSR-Events).
Like I've said, just bouncing ideas but yeah, not in the scope of the current specs.Could be considered in the future as well.
Hi Florin,I would not consider it neither now, nor in the future. The cache interface/spec should only care about caching. Having everything mixed in at the interface/spec level is bad as it will only add clutter and will increase the confusion. Besides antipattern symptoms having the onMiss() implies that there should be an onHit(), or even onExpire(), onChange(), onDelete() etc.Like I've said, just bouncing ideas but yeah, not in the scope of the current specs.Could be considered in the future as well.Also, if the interface/spec enforces a specific programming paradigm (in this case - the event driven programming paradigm), it will certainly not be adopted by member/non-member projects that have a different philosophy.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
That tells me as a user that I can make no assumptions whatsoever about what a legal key value is, and I'm entirely at the mercy of a given implementation. That is, if a given implementation decided to only allow lower-case alphabetic keys up to 5 characters, that's spec-legal (even if a stupid implementation). TTLs are already handled in the previous paragraph, so should not be mentioned here. For keys, we should define at least a minimum baseline. I'd recommend mandating that all implementations MUST support, at minimum, unaccented alphanumeric characters plus underscore in mixed case up to 32 characters long, in UTF-8 encoding (or compatible, since what I just described is also basic ASCII). If a given implementation wants to also support full UTF-8 keys, or allow 64-character keys, or allow the infamous snowman character, cool. But I as a user should be able to rely on at least that common baseline of UTF-8 alphanumerics.
Do you think we should specify that currently, to ensure compatibility with most/all existing cache systems we should add a section that says that only ASCII alpha-numeric characters are allowed?
Section 2.1:
I thought we were leaning toward offering both isHit() and isMiss()? I'm fine either way with isMiss(), I don't much care, but I am surprised to not see it here after the previous thread.
I thought that we are going for only one of them, can't remember which.
We specify that getMultiple() must return a keyed array, which is good. Should we also mandate the same order as the original $keys array, or explicitly NOT require that? (We should do one or the other; I'd favor requiring it to match, but could see an argument either way as long as it's explicit.)
I'd favor for allowing implementations to return the keys in any order as long as they are ALL there. Sorting them in the input order would be a unnecessary waste of cycles imho.
getMultiple($keys); // $keys should be type-hinted to array
The $ttl parameter for setMultiple() should be written in plural. Right now it's just a copy/paste of set(), so it reads awkwardly.
The TTL in setMultiple is applied to all the items and it's not an array, does it really make sense to have it as plural? (non-native English speaker here btw)
The various boolean returns are either not documented, or documented as "the result of the operation". That tells me nothing at all. If we're returning meaningful information, then it should be explicitly TRUE for a successful write or FALSE if the data could not be written. If not, we should return $this to allow chaining.
I'd be more interested in the result of the operation rather that chaining so returning boolean would be the way to go if you ask me. Granted this should be documented a bit better/more clear.
Which, actually, brings up an interesting question. Are there any exceptions we should be throwing here? If not, should we document that exceptions must NOT be thrown? Or that they MAY be thrown if the underlying implementation throws it? (Eg, a DB cache throwing a PDOException.) I'm not sure what the correct handling here is, but we should think through the failure conditions and how they should be treated so that implementers and clients can be consistent and know what to expect.
As mentioned above, a better documented boolean return type would be better imho.Throwing exceptions just to signal that something went wrong is not a really good thing. Plus exceptions should be used for 'exceptional' cases when the program execution can't continue, at this is how I view them. In your example, with PDOException, that will be the implementing library job to catch the exception and return false when it occurred rather that send it to the upper level. Else we'll end up with having a boat load of exceptions that will need to be added to cover scenarios and so on and I think it's a bit of an overkill for something that should by default be lightweight - cache.
I'm not suggesting we debate how to implement tagging or other features right now; However, given that we want to allow people to experiment and innovate on top of this model, and we want to be able to extend it ourselves in the future, I think building in the extra flexibility now to allow that to happen is worth the relatively modest extra effort now. (For implementers not doing anything fancy with setItem(), it's a single line of code to have it defer to set(). Trivial.)
If you do however want to suggest things around a more advanced interface, you can do so with the preview here: https://github.com/dlsniper/fig-standards/blob/extended-cache-proposal/proposed/psr-extended-cache.md Just sayin' ;)
And you are right, extending the CacheItem should be the way of doing it.If we look into the future, maybe a set/get/removeItem/s could be added in the future to support working with full CacheItems with no BC breaks to the current interface. I'll update the demo from above to provide a better picture.That said, in the interest of simplicity, I think the current proposal covers both simple usage and future extensibilityThe other differences with Robert's proposal come down to "where to put the method" (I like them where they are in this proposal) or implementation details (the aforementioned "item contains the cache engine" question) that by design should *not* be part of the spec. But the coupling of CacheItem to Cache is, I believe, valuable, and would allow both us and implementers far more leeway to experiment and extend in the future.
I think current proposal, Paul's, allows for toying around with where to put your actual retrieval of the value, see the gist provided above, while still being consistent for the end-user. I'm not sure how this could affect interaction between various vendors, Doctrine and Zend for example being able to swap only the item/drivers (if this is really wanted).
Hi Florin,
Like I've said, just bouncing ideas but yeah, not in the scope of the current specs.Could be considered in the future as well.
I would not consider it neither now, nor in the future. The cache interface/spec should only care about caching. Having everything mixed in at the interface/spec level is bad as it will only add clutter and will increase the confusion. Besides antipattern symptoms having the onMiss() implies that there should be an onHit(), or even onExpire(), onChange(), onDelete() etc.
Also, if the interface/spec enforces a specific programming paradigm (in this case - the event driven programming paradigm), it will certainly not be adopted by member/non-member projects that have a different philosophy.
So we should do one of the following:
1) Explicitly state that implementations MUST NOT throw exceptions, and therefore MUST catch and handle any exceptions their underlying engines generate.
2) Provide a base interface that all implementations MUST throw, if they are going to throw an exception. That can be a chained exception with whatever the underlying exception was; that's fine. But I need to be able to do:
try {
$cache->set('foo', $bar);
}
catch (CacheException $e) {
// Do whatever
}
And have that not break if I change my implementation. Subclasses of CacheException are fine, CacheException that chains on top of a PDOException is fine, but that catch statement needs to work.
I'd much prefer option 2, as it allows for robust error handling. Returning FALSE tells me nothing useful.
--Larry Garfield
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
The other differences with Robert's proposal come down to "where to put the method" (I like them where they are in this proposal) or implementation details (the aforementioned "item contains the cache engine" question) that by design should *not* be part of the spec. But the coupling of CacheItem to Cache is, I believe, valuable, and would allow both us and implementers far more leeway to experiment and extend in the future.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/kPRdCcd78hMJ.
I did get a bit of "TL;DR syndrome"
Just to be clear, the CacheItem class is now immutable because the main Cache class does not handle re-persistence of CacheItem classes so it makes no sense to make it mutable for this first simple spec.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/pcsGGx0AQk0J.
I think that Robert's proposal suffers from naming confusion and "looking backwards from what people are used to doing." Going by pmjones's philosophy I would guess he'd say that we shouldn't go with Robert's solution because it is nothing like anything any of the member projects use. I'm sure a lot of people think this makes sense and in general I agree.
On 03/13/2013 09:58 PM, Larry Garfield wrote:
Hm. OK, I have a branch ready but for some reason GitHub won't let me file a PR against your repo, just the several dozen other people with forks of the repo. :-( No idea why.
Branch is here if you want to peruse and pull (or tell me why it won't let me file a PR):
https://github.com/Crell/fig-standards/tree/cache-languageIt's a bug in github. They told simensen a workaround for it but I don't understand it yet.I've manually pushed in your changes Larry, thanks!
On Thu, Mar 14, 2013 at 4:02 AM, Larry Garfield <la...@garfieldtech.com> wrote:
On 03/13/2013 09:58 PM, Larry Garfield wrote:Hm. OK, I have a branch ready but for some reason GitHub won't let me file a PR against your repo, just the several dozen other people with forks of the repo. :-( No idea why.
On 03/13/2013 07:40 AM, Paul Dragoonis wrote:
Thanks guys for all the replies, I read everything.
Larry,
These introductory paragraphs were taken from the proposals that existed previously.
Could you or someone write up a revised copy of them that makes more sense and conforms to the interfaces listed?
Well some of them are still being discussed (see elsewhere in this thread), but I'll file a PR for the ones I think are non-contentious.
Branch is here if you want to peruse and pull (or tell me why it won't let me file a PR):
https://github.com/Crell/fig-standards/tree/cache-language
It's a bug in github. They told simensen a workaround for it but I don't understand it yet.
I've manually pushed in your changes Larry, thanks!
Hey group,The caching proposals have been open for the best part of a year now, we've been providing lots of revised implementations and had lots of discussions which we've had a vast amount of good feedback about. This email and effort from us guys involved is to bring closure and finalisation to this PSR Cache effort.What we have here [1] now is the result of the long-term ongoing discussions and cache proposals that we have so far. The three open proposals were from Robert, Evert and Florin. Evert's and Florin's proposals have now been closed and superseded by this new proposal in an attempt to centralise our efforts into one main proposal now rathe than multiple forks.What does this new proposal entail?-----------------------------------------------The good parts from all three proposals including the valid points raised from Robert's and his proposal. It's a merger and combination of all three previous proposals apart from one significant difference with Robert's proposal (detailed next) which is why his is still open.
What do we need to do?-------------------------------1) I'd appreciate it if everyone could review the text and the code interfaces on the proposal [1] and raise any final details missing with it. For small typos sentence restructuring you're welcome to use github for these type of small edits so not to spam this mailing list thread.2) A vote on if they feel the cache driver instances being part of the primary Cache class [1] or being part of each child CacheItem class [2].The vote can be a response to this email by saying,In favour of:Proposal 1: Yes or NoProposal 2: Yes or NoThis is not the official vote for if that PSR Cache proposal should be accepted but to give perspective over which one they think would be better received by the FIG member projects.
Comparison with remaining proposal-----------------------------------------------Robert's proposal [2] is still open, the only significant and unique difference here is that- On the joint effort proposal [1] the cache drivers such as Memcached or Redis instances/drivers are part of the main Cache class, so you can do something like:$cache->set($key, $val)or$cache->remove($key)This is just like you can with the existing Memcached and Redis instances available for PHP today.- On the proposal from Robert [2] it has the connected driver from Memcached inside each individual child CacheItem classes rather than one copy of that in the main Cache class and you would do something like:$item = $pool->getItem($key);$item->setValue($val);or$item = $pool->getItem($key);$item->remove();I hope this email was coherent enough for everyone, please ask me to clarify anything that was unclear or missing.Thanks,Paul Dragoonis
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/LsgbUynd9dgJ.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/_OZdn3a_0y8J.
Hi all,
I'll respond by Monday. I'll also try to get some ZF feedback from the
Zend\Cache maintainer. Is there any timeline on when the window for
feedback will close?
Paul, just wondering what the plan is for moving this forward?
Also, I'm just wondering if it's worth slipping in a CacheAwareInterface like we already have in Log.
Regards,Andrew Eddie
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+u...@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/php-fig/-/UPF1DZFpcE4J.
Hi Andrew,
On Tue, Mar 26, 2013 at 12:18 AM, Andrew Eddie <mamb...@gmail.com> wrote:
Paul, just wondering what the plan is for moving this forward?The cache discussions have been maturing for about a year now. I'm ready for a vote. There were some questions or statements made about zend framework cache stuff by Padraic which hasn't happened yet.I'll take it now that no news is good news and call a vote this Friday coming if nobody has anything else that will mature the proposal further.Also, I'm just wondering if it's worth slipping in a CacheAwareInterface like we already have in Log.I agree with this, and we should try to have an Aware interface with each Psr proposal so that people can start injecting loggers and cachers in places. Good suggestion! I'm going to add it to the proposal.
an email to php-fig+unsubscribe@googlegroups.com.
To post to this group, send email to php...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msg/php-fig/-/_VC0G2mGGXcJ.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-fig+unsubscribe@googlegroups.com.
We follow the way of memcached or redis set.->set($key, $val, 300) // alive for 5 minutesIf the text on the proposal needs updating please update this somehow, github is preventing people from forking my repo because of some kind of fork limit.
github is preventing people from forking my repo because of some kind of fork limit.
It's not a 32 character limit (at least if it's using the language I
wrote that Paul merged.) It says that implementations may not have a
character limit LESS than 32 characters. If an implementation wants to
allow a 128 character key it can, but it cannot allow only a 16
character key. If that's not clear, it should be clarified.
I'm not sure why we are forcing the developer to make up minimum length keys when you'd mostly be dealing with human-readable-esque keys anyway (eg "joomla.content.category.1") - it sounds like something the caching engine should do under the hood.
It says that implementations may not have a character limit LESS than 32 characters. If an implementation wants to allow a 128 character key it can, but it cannot allow only a 16 character key.
What Beau said. *Any* key up to 32 chars in length consisting of UTF-8 alphanumerics must be legal. So "foo", "bob", "123456", etc. are all legal keys. If an implementation wants to be more permissive it can, but it cannot be less permissive.
As for the specific length, I made up 32 kind of at random. I don't really care what the actual minimum max-length is, but I think it's important to have one.
--
Hi all,
My apologies for the delay, but work commitments kicked in and I
needed to get feedback from the other ZF CRTeam members.
Comments on the Cache Proposal by the ZF Team:
1. Can we define TTL to always be an integer and remove the "normally"
qualification that suggests this is optional and can be something
other than an integer?
2. Can we soften wording on Key definition to allow integers as a valid key?
3. Can we clarify in the standard whether CacheItemInterface objects
are immutable, i.e. Value Objects?
4. CacheItems are not accepted as Keys despite representing a keyvalue
pair which suggests CacheItems are immutable and must be discarded
after a single read in favour of potentially updated values. Standard
needs to reflect intended usage.
5. There are some concerns about the presence of a separate
CacheItemInterface but no overwhelming objections from the ZF team.
Other comments:
1. The introduction seems vague and confusing. The first paragraph
basically says that there are difference caching libraries. This is
obvious and shouldn't require stating. The second paragraph suggests
that a caching interface will solve these "problems". Having multiple
caching libraries in not a problem. I think this is a clear
misunderstanding on my part but that's what I read into it. We need to
be clear and explicit to the point of spelling it out why the
interfaces are a good thing for users of caching libraries, i.e. easy
substitution, adoption, and sharing between applications or, as we
call it around here, interoperability.
2. Definitions. I love Markdown but let's just use HTML definition
lists since Markdown does not support a specific syntax for that.
3. As earlier, is TTL "normally" an integer or "always" an integer.
We're missing an RFC 2119 keyword in there.
4. Key definition: "Implementing libraries are responsible for any
encoding or escaping required by their backends, but must be able to
supply the original key if needed." Clarify? What is the original key?
Unescaped or escaped form? Who tracks the original key? The user or
the backend which reads the user's mind to supply the original key?
5. CacheItem & Cache - should be added to definition list and then
explained in greater depth in their respective sections.
6. "By using the CacheItem, implementations can guarantee consistency
across various systems." How? Why? Most programmers will see an
additional object that complicates usage but there's no nod to that
concern or an explanation to put those users at ease.
7. Key rules: Why a 32 character limit? Why is regular expression
emphasised instead of plain fixed width font? The regular expression
and the list of characters appear to be mismatched. Where is the unit
test for the rule?
8. isHit: I'd support a matching isMiss() check but if support is
against that so be it ;).
9. CacheInterface: I can't read the method comments without scrolling
on this PC. Isn't there a maximum line length for non-wrapping
code/text we should be applying?
10. Should we treat code comments as being required reading to
understand the standard? If so, it should apply RFC 2119 and be as
explicit as possible to avoid ambiguity. Explicity will make you look
stupid for stating the obvious so saying that get() accepts a key
name, uses key name to construct CacheItem capable of retrieving cache
value is better than saying "Here we pass in a cache key to be fetched
from the cache." We're not fetching the key that we already know...
"The result of the delete operation" TRUE being success, right? I'm
being silly, but please state the obvious or some folk will swarm us
seeking clarification and arguing about intended meanings just for the
fun of it.
11. Why are expected arrays in arguments not typehinted as "array"???
12: "This will wipe out the entire cache's keys" Clarify? Is this the
"rm -Rf /" of the cache world?
13. Example for PsrCacheItem shows CacheItem having a setValue()
method not defined in the interface. The example doesn't actually send
anything back to a driver though so probably needs removal.
14. I'm loathe to include examples within a standard when the unit
tests are missing... Are they part of the standard? If not, remove and
post them independently as a sort of "Guidance" document. Let the
standard stand by itself.