• Resolved pablomarticordero

    (@pablomarticordero)


    Hello,

    I’m trying to configure Cachify with AWS elasticache but I feel like I’m missing something. Whenever I configure it with the cluster endpoint URL / PORT it seems like its not sending items to the Memcached cluster. If I configure Memcached on the server where WordPress is running and have nginx pass to that it works fine.

    I have confirmed that I am able to access elasticache from the EC2 via telnet and that I am able to create an index and retrieve it. This doesn’t seem to be an issue on my end and I don’t see any information in the documentation on it. Hoping to get more info from here.

    Thanks

Viewing 1 replies (of 1 total)
  • Hi,

    Whenever I configure it with the cluster endpoint URL / PORT it seems like its not sending items to the Memcached cluster.

    Just to be sure, you’re doing something like this, right?

    apply_filter( 'cachify_memcached_servers', fn () => [ [ '*****.cache.amazonaws.com', 11211 ] ] );
    (or equivalent older PHP notation)

    Note the nested array, because the result is passed to addServers().

    I have confirmed that I am able to access elasticache from the EC2 via telnet

    Have you checked via PHP? E.g. with such simple roundtrip script using the same settings and methods Cachify uses (just hacked down, might contain typos)

    <?php
    echo "initialize memcached";
    $memcached = new Memcached();
    if ( ! $memcached ) die(" FAILED");
    
    echo " ✓\nconfigure memcached";
    $res =$memcached->setOptions( array( Memcached::OPT_COMPRESSION  => false, Memcached::OPT_BUFFER_WRITES => true, Memcached::OPT_BINARY_PROTOCOL => true ) );
    if ( ! $res ) die(" FAILED");
    
    echo " ✓\nadd servers";
    $res =$memcached->addServers( array( array( '*****.cache.amazonaws.com', 11211) ) );
    if ( ! $res ) die(" FAILED");
    
    echo " ✓\nwrite test object";
    $res = $memcached->set( 'testkey', 'testvalue', 60 );
    if ( ! $res ) die(" FAILED");
    
    echo " ✓\nread test object";
    $res = $memcached->get( 'testkey' );
    
    if ( 'testvalue' !== $res ) {
        echo " FAILED\n";
        print_r( $res );
        exit(1);
    }
    
    echo " ✓\ndelete test object";
    $res = $memcached->delete( 'testkey' );
    if ( ! $res ) die(" FAILED");
    echo " ✓";

    If this didn’t do the job yet… Are you using the distribution’s or PECL extension for Memcached or the ElastiCache extension?
    Cachify always calls addServers() with [['127.0.0.1', 11211]] by default which might interfere with the autodiscovery feature. I haven’t tried yet, but you could try an empty argument in this case:
    apply_filter( 'cachify_memcached_servers', fn () => [] );

    Cheers,
    Stefan

Viewing 1 replies (of 1 total)

The topic ‘Cachify with Elasticache’ is closed to new replies.