Skip to content

Extending MemcacheClientBuilder to more easily allow other AbstractMultiMemcacheClient impl #198

@jreilly650

Description

@jreilly650

Hi,
I am currently looking at using folsom. One thing I want to do it to implement my own sharding (to match existing impl). To do this, I was planning to implement a class extending AbstractMultiMemcacheClient similar to KetamaMemcacheClient.

Initially I was planning to extend MemcacheClientBuilder, noticing that the MemcacheClientBuilder.connectRaw method is protected, however on closer inspection I noticed that many fields that one might want to use in that method (such as this.addresses) are not accessible. Would you have any objection to a patch that changes the current set of fields from private to protected?

Another possible alternative I was thinking about is addition of a method to the builder that allows one to pass in the code to create an AbstractMultiMemcacheClient given a list of addresses. e.g.

MemcacheClientBuilder<V> withRawClientCreator(Function<List<HostAndPort>, RawMemcacheClient> clientCreationFunction)

Then in connectRaw, use the function if it is not null, otherwise use the existing logic. Either something like this, or being able to extend and override connectRaw would work for me, but I'm wondering if there would be any interest in a solution like withRawClientCreator? Let me know what you think.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions