Question

How to use memcached in the app platform?

I am trying to figure out the best alternative to use some sort of memory caching for a Django application with a postgress database deployed on DigitalOcean App Platform.

I cannot see any documentation of how to include memcached or any other in-memory management tool as part of the App Platform deployment.

Any Ideas will be appreciated


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

ahmedbutt
DigitalOcean Employee
DigitalOcean Employee badge
May 4, 2021
Accepted Answer

Hi @mariorossell Memcached is an in-memory data storage system. You can run Memcached as an internal service in the App Platform. It is an internal service therefore there will be no HTTP route or PORT set.

A sample code for a Memcached service can be seen like below

Sample Code for Memcached internal service
- name: library-memcached
  image:
    registry: library
    registry_type: DOCKER_HUB
    repository: memcached
    tag: latest
  instance_count: 1
  instance_size_slug: basic-xs
  internal_ports:
    - 11211

Other services can access the Memcached service using <servicename>:<internal_ports> like below for the above sample Memcached service.

  1. library-memcached:11211

After successful deployment, to connect other services with Memcached service, run the below command in the service console from whom you want to connect Memcached with.

  1. telnet library-memcached 11211

Note: App Platform instances are ephemeral and can be redeployed at any time which would cause the contents of the Memcached server to be lost.

Other than Memcached for in-memory data storage, we also provide Redis as a managed database in the Digital Ocean. You can view the below links for information related to how to create Redis Database and how to manage databases in the App Platfrom.

Redis Database in Digital Ocean How to manage Database in App Platform link

I’m a little late to reply, but for posterity, the MemCachier Add-On from the DigitalOcean Marketplace is now available, enabling you to provision a Memcached-compliant cache for your App Platform app with one click.

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel