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.

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

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.