So we finally have a stable D6 release, so now it's time to get something out for Drupal 7. I have a lot of thoughts about how this can be accomplished and here are some of them:
Create a cache plugin for varnish
The cache plugins are improved in Drupal 7, so instead of trying to do the same thing that core does ourselves for purging the cache, we could just implement a cache plugin that the site uses. This makes the varnish cache implementation work just as all other cache plugins does, instead of it being stand-alone as it is right now. This will result in quite a bit less code.
Replace the current procedural code for connecting with a class
Instead of having procedural code for connecting to a varnish terminal and issue commands, we could have a class that represents a connection. This class should have a method for each command that you can execute in the varnish terminal.
This means that:
* Each connection can be made easily by creating an instance of a VarnishConnection class.
* Everything you would want to do with the terminal is easily accessible and abstracted.
It might be a good idea to have these connections as ctools plugins, so that you could extend it and provide your own connection classes that handle stuff differently and provide more functionality. For this to be accessible, we will need an interface that describes what should be possible with a varnish connection.
By doing this, the varnish module will become easier to extend and use as an API module for dealing with Varnish.
Comments
Comment #1
danepowell commentedRelated issue: #927860: Varnish: Drupal 7 version
Comment #2
rwohlebsubscribe
Comment #3
helmo commentedsubscribe
How mush work would you expect to go into converting to a class structure and better using the core plugin structure?
If this will be considerable then it might be better to save the above for a 7.x-2.x and first do a straight port using the patches already in #927860: Varnish: Drupal 7 version and maybe with some help from the coder module.
I'd love to review either way.
Comment #4
fabsor commentedHi!
I actually have quite a bit of code already, so I think we can just go for a new release with more features directly.
The code is going on over here:
http://drupalcode.org/sandbox/fabsor/1089352.git/tree/refs/heads/7.x-2.x
It is not currently working, but most of the concepts are already in place. Thank you for your interest! I will certainly need a few eyes on this.
Comment #5
Macronomicus commentedYay.. subscribing!
Comment #6
sylv3st3r commentedReady for battle~
Comment #7
fabsor commentedSo I decided that it would make sense to release a more or less straight port of the Varnish module we have now for D7 first, since many people need the functionality badly, and it will be easier to fix issues between the versions, so it won't be that difficult to have two rock solid releases out there. The only new feature I added to the D7 version is that it is implemented as a cache backend plugin.
The work outlined here will continue as the 7.x-2.x branch, and now we can take our time to do a really awesome 2.x version with lots of new interesting features!
Comment #8
Macronomicus commentedSweet! Im waiting for d7 upgrades until this is in place, I think its time I start testing the d7 setup.
Cheers!
Comment #9
misc commented