Improve Cinder API cache implementation
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Cinder |
Fix Released
|
Wishlist
|
Mathieu Gagné |
Bug Description
The current cache implementation found in cinder.
Only a bunch of generic methods are provided:
- cache_resource(
- cached_
- cached_
As you can see, the name is optional. Current API code never explicitly provides the resource type name. This could be problematic is we try to cache 2 types of resources during the same request.
Furthermore, the documentation provided in cinder.
Different resources types might need to be cached during the same
request, they can be cached using the name parameter. For example:
Controller 1:
Controller 2:
The second parameter of cache_resource is id_attribute, not name.
To improve the situation, it has been suggested to take the Nova's implementation instead.
The Nova's implementation provides a better interface. Each resource type has a dedicated method which makes the resource type cached explicitly mentioned.
An example of such implementation for Cinder would be:
- cache_db_
- cache_db_
- get_db_volumes() vs cached_
- get_db_volume(id) vs cached_
This interface makes it clear that a volume is added or retrieved from the cache. A side-effect is that code will be shorter.
The proposed implementation will be backward compatible for people with out-of-tree extensions by preserving existing methods and still using the same variable to store the cached resources.
Changed in cinder: | |
status: | New → Confirmed |
importance: | Undecided → Wishlist |
description: | updated |
Changed in cinder: | |
milestone: | none → kilo-1 |
Changed in cinder: | |
status: | Fix Committed → Fix Released |
Changed in cinder: | |
milestone: | kilo-1 → 2015.1.0 |
Can you provide either a few more details (or a spec please)? As it stands I'd say this was incomplete, I don't even know which cache you are referring to.