--
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/msgid/php-fig/d9d3dada-c9f9-40f8-83b5-69f55eb5fb8f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
A slightly inferior solution is imho still better than a no solution at all.
Why are these the only two options? I don’t understand why we wouldn’t just stick with what we have today. IMO the Pool/Item model is the most intuitive model proposed, and adding a referenced variable only serves to make it less intuitive.
Can you articulate the reasons against?
Evert
--
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/msgid/php-fig/ba478165-6c0c-4866-a605-8d88b4fc904d%40googlegroups.com.
On Wed, Oct 22, 2014 at 9:41 PM, Evert Pot <ever...@gmail.com> wrote:
On Wednesday, October 22, 2014 4:31:46 PM UTC-4, Korvin Szanto wrote:A slightly inferior solution is imho still better than a no solution at all.
Why are these the only two options? I don’t understand why we wouldn’t just stick with what we have today. IMO the Pool/Item model is the most intuitive model proposed, and adding a referenced variable only serves to make it less intuitive.
Can you articulate the reasons against?
It's a more intuitive, simpler API and by reducing the surface area, I think it would be easier for people to support it and finally bring to completion.
I realize this is mostly a subjective argument, but I'm also kinda bored of PSR-6 still being a topic, after 3 years.
Can we just bring this to a vote? I would still +1 the current approach.Yes, we can.
Keep in mind that I would support moving it to review as soon as tomorrow, and having it get voted on immediately after.
--
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/msgid/php-fig/e24647ff-4a13-41a3-be62-01b33b49c287%40googlegroups.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/msgid/php-fig/BD4AA3B3-DFFE-4DF5-B211-EC7067008815%40tedivm.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/CAAyV7nHdmB%3DXcnbBq1avpuTWEW3oSAigtW8cgimX_oQhUOXeTw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
This response is based off of one big assumption- that my post was a direct response to yours. What it was, in fact, was "A Walkthrough of PSR-6"- that's why I started with the Driver Model, based off of Evert Pot's work, and discussed how that evolved into the form that it is today.
You're right, I don't address many of your points. That was never my intention. Instead I wanted to make sure that everyone in the conversation was aware of how we got to where we are so that we could have a conversation where everyone was informed about what the current proposal is doing.
Rob
Anthony, you say we should just return null for everything. That's ok, we can define that in our interface. Regardless of driver, we can say to people: null - even if its a value - means a miss. Cool?The trouble is, WinCache and APC return false on a miss/failure. The imlementing library will have to look at that false and convert it to null to match our interface rules. That means that both false and null now mean miss.The confusion that Robert outlines comes from If you use the same library with WinCache backend, then switch it out to a different one, then false may or may not come back as a valid result, or a miss.
Switching to a different cache system should not mean that false is suddenly out of bounds.If another system uses -1 as a miss value, then that will also be converted to to comply with our interface.This means that now -1, false and null in the cache, might mean a miss and return a null. Sometimes. That could be hell to debug.
The confusion that Robert outlines comes from If you use the same library with WinCache backend, then switch it out to a different one, then false may or may not come back as a valid result, or a miss.
--
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/msgid/php-fig/d26fca36-21aa-41aa-9ac1-2ca8ded09ddf%40googlegroups.com.
So no, "both false and null now mean miss" is not true.
The reason I wrote the post that I did was because it seemed to me that a lot of criticism over the current standard come from misunderstandings. Phil, your last email is one of them- at no point do the different backends having different return values step into this. In fact that problem isn’t unique to any model of caching- whether the Pool/Item, Driver or the SimpleCache variant Anthony is proposing you are still going to have to standardize the results of a miss from the backend.The confusion that Robert outlines comes from If you use the same library with WinCache backend, then switch it out to a different one, then false may or may not come back as a valid result, or a miss.That to me has *never* been a problem, for the reasons I mention above and that Anthony outlines.Rob
Sometimes developers want to store negative values such as false, null or 0. This is perfectly acceptable behavior and a lot more common than people think.
The naive approach is to say that you look for one value (say, null) in most situations but in the situation where you want null as an accepted output you look for something else (like false). This ignores times where both results are acceptable, but that may be rare enough to not worry about. However, it does make for sloppy API design as developers will be expecting different return values in different places to represent the same thing. That being said, PHP has never gotten flack from people over inconsistent API expectations so there’s no point in worrying about that now right?
Sometimes developers want to store negative values such as false, null or 0.
Ok, let's look at this in detail. The API I proposed in my blog posts has0
andfalse
and[]
defined to be perfectly acceptable values.null
is the only one that's not.
So you're already showing that you don't understand what I said. Or you do, but are purposely ignoring it.
This is perfectly acceptable behavior and a lot more common than people think.
Forfalse
and0
, completely fair. Butnull
... Why would you want to cache null?
--
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/msgid/php-fig/aeea72fe-c63d-482b-8950-2c843d312ea3%40googlegroups.com.
Anthony is arguing that the driver interface dropping support for null is not enough reason to add an item interface. I'd say this is backwards, because we do not agree that the driver class is by default better, and we are already near voting stage with the pool item interfaces.
Anthony should instead be talking about why the pool/item proposal is such a detriment that it warrents dropping support for null.
The main argument I've read against it is that its unintuitive, and I simply do not agree. Can anyone help convince me that what we have is actually WRONG and not subjectively "less right"?
--
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/msgid/php-fig/aeea72fe-c63d-482b-8950-2c843d312ea3%40googlegroups.com.
--
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/fUwLr4TVNok/unsubscribe.
To unsubscribe from this group and all its topics, 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/msgid/php-fig/4C3FD0DA-C4CD-4432-B759-5C2AF46AB081%40tedivm.com.
However you can accomodate both the null and false values without a wrapping item class. As I've demonstrated in the implemenation that I've propose, you can just return an iterator from the cache.
How is this any different from the item interface other than it being less semantic and more confusing?
The concern with requesting whether it exists before retrieving is the race condition it may cause.
Why is returning an iterator different than defining a minimal interface that has an isMiss method and a getValue? Returning an iterator that shouldn't ever be iterated upon is definitely confusing and not semantic.
I'd more readily throw an exception on a miss than return an iterator that isn't for iterating, but I don't see why this is needed when we can just have an item interface defined.
Your point of the pool needing to know how create items is reasonable, but that sounds like less of an issue than having to normalize "not set", and can be handled by the implementation pretty simply by the implementation.
--
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/msgid/php-fig/4203ee0a-649f-4210-8a69-f17f5ae16472%40googlegroups.com.
The concern with requesting whether it exists before retrieving is the race condition it may cause.
Why is returning an iterator different than defining a minimal interface that has an isMiss method and a getValue? Returning an iterator that shouldn't ever be iterated upon is definitely confusing and not semantic.
I'd more readily throw an exception on a miss than return an iterator that isn't for iterating, but I don't see why this is needed when we can just have an item interface defined.
Your point of the pool needing to know how create items is reasonable, but that sounds like less of an issue than having to normalize "not set", and can be handled by the implementation pretty simply by the implementation.
To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/5a42b1d1-fff6-44a8-8d89-0deb72b190e6%40googlegroups.com.
deleteItem() was deliberately omitted as typing $pool->deleteItems(['my_key']) is easy enough and it eliminates an unnecessary method.