Repository navigation
Api Method "deleteItemsByTagsAll()" removes unrelated items #713
Description
Activity
Hello,
I don't have much time actually, can you give me a sample of code so I can test it quickly ?
Cheers,
GeorgesHello,
I don't have much time actually, can you give me a sample of code so I can test it quickly ?
Cheers,
GeorgesHi,
Not by hand but I think your increment, or one of the other examples, fits. I see if I can make one out of it.
Regards,
Hmmm I think I know why we have this kind of behavior:
Item A with tags "shared"
Item B with tags "shared, custom"- I check if the item's tags are all effectively in the
deleteItemsByTagsAll(['shared')]request. Which is the case: A and B own this tag.
But B has also an additional tag: "custom" which is ignored, why ?
If the scenario was the following:Item A with tags "shared, shared2"
Item B with tags "shared, custom"If
deleteItemsByTagsAll(['shared, shared2')]was called, only the item A would be deleted, because B doesn't have the tag "shared2"In a nutshell: When
deleteItemsByTagsAll()is called, I'm checking for the presence of all requested tags, but I'm not checking if all the tags in the ITEM are in the REQUEST.This strange behavior will be fixed as soon I can.
Cheers,
Georges- I check if the item's tags are all effectively in the
I think that all
*ItemsByTagsAll()methods are affected by this, can you confirm this behavior to me @di-rect ?@Geolim4 thanks for the feedback, sounds reasonable why it happened.
I cannot confirm if this happens with all
*ItemsByTagsAll()I think I can test that for you but don't use them as I don't have a use-case form them in this stadium yet.Have you seen the same behavior ?
Have you seen the same behavior ?
I can't test it right now, this is the reason I'm asking you more details :)
Have you seen the same behavior ?
I can't test it right now, this is the reason I'm asking you more details :)
I need to see if I can make an in-code test-case. Otherwise I can try to make one but I found this out in the heat of the moment as well so I keep this open and I try to test it out as well.
If I'm right I need to create one, let me try to focus on that tomorrow.
- changed the title
[-]deleteItemsByTagsAll() removes unrelated items[/-][+]Api Method "deleteItemsByTagsAll()" removes unrelated items[/+]on Dec 3, 2019 22 remaining items
Hello !!
🆕 in V8: Multiple strategies (
$strategy) are now supported for tagging:TaggableCacheItemPoolInterface::TAG_STRATEGY_ONEallows you to get cache item(s) by at least ONE of the specified matching tag(s). Default behavior.TaggableCacheItemPoolInterface::TAG_STRATEGY_ALLallows you to get cache item(s) by ALL of the specified matching tag(s) (the cache item can have additional tag(s))TaggableCacheItemPoolInterface::TAG_STRATEGY_ONLYallows you to get cache item(s) by ONLY the specified matching tag(s) (the cache item cannot have additional tag(s))
This has been implemented as of the API v3
- [BC] Removed
ExtendedCacheItemPoolInterface::appendItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - [BC] Removed
ExtendedCacheItemPoolInterface::decrementItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - [BC] Removed
ExtendedCacheItemPoolInterface::deleteItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - [BC] Removed
ExtendedCacheItemPoolInterface::getItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - [BC] Removed
ExtendedCacheItemPoolInterface::incrementItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - [BC] Removed
ExtendedCacheItemPoolInterface::prependItemsByTagsAll()(replaced by strategyTaggableCacheItemPoolInterface::TAG_STRATEGY_ALL) - Added strategy
TaggableCacheItemPoolInterface::TAG_STRATEGY_ONEusable in every**byTags**methods. - Added strategy
TaggableCacheItemPoolInterface::TAG_STRATEGY_ALLusable in every**byTags**methods. - Added strategy
TaggableCacheItemPoolInterface::TAG_STRATEGY_ONLYusable in every**byTags**methods.
Expect the V8 to be released by the summer 2020 :)
Cheers,
GeorgesSorry for my late response, but this is great!
Is V8 already usable without being released ?
Thanks a lot!
Sorry for my late response, but this is great!
Is V8 already usable without being released ?
Thanks a lot!
Hello, nope it's still in development status, despite the tests are ok, I would not recommend it for use in a production environment !
I still have a bunch of docs & tests to made.
Hi,
I got mentioned by someone (that was involved here), maybe this is usable for this as well to make dev easier ? https://github.com/team-a-pro/collection
See the discussion above :)
See the discussion above :)
I know but I meant if future development makes it easier why not switch instead ? Not that it's needed, if it saves time I would say... a refactor is never a bad learning curve :)
Yes it does what you meant, because the tags now supports all possible use cases. It is implemented in V8 because it's not backward compatible and would break the SemVer.
All the available strategies are interfaced here:
Which is great! I though I just notice you when you want to be 'lazy' in the future :)
- added and removed
on Feb 21, 2020
When You add multiple items that have their own tag and also share a tag it seems that when you delete an item using
deleteItemsByTagsAll(['sharedTag', 'ownTag'])that all items that share'sharedTag'are also removed.Following the docs it should only remove items that have multiple tags or all you set for this function, not one or more like deleteItemsByTags() does.
This happens for me on Couchbase buckets.
To Reproduce
Steps to reproduce the behavior:
deleteItemsByTagsAll(['sharedTag', 'ownTag'])So 10 items should be in total 21 => 10 items, 10 unique tags items, 1 shared tag item
Expected behavior
One item removed and one (unique) tag, so 2 items less in the bucket and the rest should stay
Current behavior
All items that share the shared tags are removed, so also are their individual tags.