To my findings there are two ways to implement this feature:
- Reuse the BucketManager for this, since it already provides basic capabilities for flushing (but needs some extension).
- Reimplement the whole thing.
I would go with extending the BucketManager for this, since it would also keep the CouchbaseClient itself lean.
There is one thing that we need to decide upon: we can't just override the flush() method, because the returned value is different (we can't return an operation future with the current implementation). If we want to, we could "fake" it into one (but I doubt it makes sense). Therefore I propose a new method (flushBucket) which should be used with the couchbase client and we need to document that the old flush methods only work against memcached servers.