Open Bug 681191 Opened 14 years ago Updated 12 years ago

creating a version should invalidate the product's cached version list

Categories

(Bugzilla :: Administration, task)

4.0.2
task
Not set
normal

Tracking

()

People

(Reporter: glob, Unassigned)

Details

when you create a version on a product, the product's cached list of versions is not invalidated. $product->versions; # prime cache Bugzilla::Version->create({ product => $product, value => $name }); $count = scalar grep { $_->name eq $name } @{$self->_target->versions}; $count is 0, when it should be 1. Version->create should delete $product->{versions}.
I don't think it should invalidate it. It should rather add the new version to the cache, if there is no sorting issue.
Ah, could you specify exactly what bug this is causing? Cache invalidation is something I try to never, ever have Bugzilla do. (Instead I just encourage people to re-create new objects.)
(In reply to Max Kanat-Alexander from comment #2) > Ah, could you specify exactly what bug this is causing? Cache invalidation > is something I try to never, ever have Bugzilla do. (Instead I just > encourage people to re-create new objects.) We do cache invalidation in many places, e.g. every time we touch groups. This is a good thing.
(In reply to Frédéric Buclin from comment #3) > We do cache invalidation in many places, e.g. every time we touch groups. > This is a good thing. We do very specific cache invalidation in very specific areas, and only when it actually has a specific purpose (that is, Bugzilla will break without it) and I try as hard as possible for this invalidation to not cross object boundaries. Once we start doing more invalidation, developers would depend on it, and it would become a hornet's nest of interdependencies without any significant advantage (in most places) over just creating a new object. If we redesigned Bugzilla to have a totally new architecture that made this cache invalidation easy, then I would support it. :-)
(In reply to Max Kanat-Alexander from comment #2) > Ah, could you specify exactly what bug this is causing? Cache invalidation > is something I try to never, ever have Bugzilla do. from an extension... i'm mirroring versions between products and encountered a situation where a product object was telling me a version didn't exist, however the database threw an error because it did. > (Instead I just encourage people to re-create new objects.) the problem with that approach is you have to know everywhere where an object may be cached internally by other objects... that's bugzilla's job, not the extension writers.
Okay. I'd accept a standard method called clear_caches that you can call on an object to have it clear all of its stored data that isn't directly loaded from its table. Ideally the object would update its internal state (that is, I agree with LpSolit) but I think that's beyond the level of complexity we want to support for now.
Also, something needs to use that method inside of Bugzilla itself, or there needs to be some unit test, so that we know when it breaks.
You need to log in before you can comment on or make changes to this bug.