Looking at dmemcache.inc there are some goofy and ugly instanceof operators that could be glossed over with dmemcache_object() returning a proxy object to the two backends. I played with this a little this morning and came up with this quick and dirty patch. No performance numbers or even testing on Memcache but Memcached seems to work great. I can't imagine the performance would change much either way since we're adding some LOC in exchange for some encapsulation and maintainability and loosing a couple relatively cheap ifs.
I think the big wins are in maintainability and with another variable we could swap out a custom proxy object tuned with logic for specific sites in the psuedo-plugin system manner.
Its possible more of the dmemcache_* function logic could be embedded in these objects too but I think that'd be a bad idea.
Looking for review and general thoughts about this approach. Obviously the patch is rough with lots of missing docs and embedded questions but the concept and meat of the implementation is there.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | dmemcacheinc_proxy_pattern_objects.patch | 13.92 KB | neclimdul |
| dmemcacheinc_proxy_pattern_objects.patch | 13.5 KB | neclimdul |
Comments
Comment #1
neclimdulnon-broken patch. helps when you test on the right install...
Comment #2
japerry