Posted by catch on September 16, 2011 at 8:48am
2 followers
Jump to:
| Project: | Memcache API and Integration |
| Version: | 7.x-1.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
I'd like to convert dmemcache.inc to a class.
We'd have an interface to determine the API, then an implementation each for Memcache and Memcached extensions. Then dmemcache_object() changes just a factory to instantiate the right class and we call methods on that.
This would remove a lot of if/else from the file - instead the extensions can just handle what they need to do or not. It'd also make it possible to swap out either of these with a custom implementation (possibly even for a key/value store that's not memcache).
Need to get 7.x-1.0 out before doing that. But as soon as that's done this feels like the next thing to tackle.
Comments
#1
I think this might also allow us to completely mock the memcache server to create real unit tests. So we could test things in MemcacheDrupal, for example the whole cache clearing/wildcard handling directly and just that. These tests could then also be executed on a normal test slave that doesn't need a special setup.
We'd just need to find a way to prevent the test bot from executing the existing integration tests, a simple check at the top of memcache.test and return if no memcache extension/configuration is found and return could help. I'm doing similar things to prevent fatal errors for tests that depend on base test classes from other contrib modules (e.g. services).