DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Creating a Web Project: Caching for Performance Optimization
  • Designing a Java Connector for Software Integrations
  • Scaling DevOps With NGINX Caching: Reducing Latency and Backend Load
  • Develop a Reverse Proxy With Caching in Go

Trending

  • Enhancing Business Decision-Making Through Advanced Data Visualization Techniques
  • Can You Run a MariaDB Cluster on a $150 Kubernetes Lab? I Gave It a Shot
  • Introduction to Retrieval Augmented Generation (RAG)
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  1. DZone
  2. Data Engineering
  3. Data
  4. Memcache Custom Connector in Mule 4

Memcache Custom Connector in Mule 4

Memcache is an in-memory key-value store short chunks of temporary data (String, object) from results of database calls, API calls, or page rendering.

By 
Sadik Ali user avatar
Sadik Ali
DZone Core CORE ·
Feb. 24, 21 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
4.1K Views

Join the DZone community and get the full member experience.

Join For Free

Agenda

  1. What is Memcache and what is its main feature?
  2. Memcache platform configuration
  3. Custom Connector Mule 4 feature (Memcache)
  4. Demo

What Is Memcache and What Is Its Main Feature?

Memcache is an in-memory key-value store short chunks of temporary data (String, object) from results of database calls, API calls, or page rendering.

  • Memcache is an in memory-based cache mechanism.
  • Memcache is not a database.
  • Memcache is not better than a database but it is being observed that in case of extended request, it performs well than persistent storage.
  • Memcache does not have any backup support.
  • It does not comply with any safety characteristics hence it is a high-performance tool.
  • This stores data in-memory compressed items. In some scenarios, it adds latency in execution due to key management issues in memory.
  • It supports distributed memory caching system which adds the feature to use more than one server to cache data.

What Type of Data Can Be Stored?

  • The output of database queries (array and objects).
  • Login tokens.
  • Sessions.
  • Temporary contents to render the page.

Memcache Platform Configuration

Limitations: 

  • Whether shared or applied, Memcache is not long-lasting storage. Keys can be deleted when the cache swells up, according to the cache's LRU policy. Changes in the cache form or datacenter support events can also clean some or all of the cache.
  • The maximum size of a cached data value is 1 MB.
  • A key should not be larger than 250 bytes. 
  • The "multi" batch step can have any amount of elements. The total size of the call and the total capacity of the data retrieved must not exceed 32 megabytes.
  • A Memcache key cannot include a null byte.
  • Memcache sustains key/value pairs. The pairs in memory at any moment change as items are recorded and recovered from the cache.
  • Values saved in Memcache are retained as long as feasible. Values can be removed from the cache when a new value is added to the cache and the cache is following memory.

Demo: Custom Connector Mule 4 Feature (Memcache)

In this demo, we are demonstrating two operations:

Get Value: Extract information from Memcache

Java
 




x


 
1
public String getKeyValue(@Connection MemcachedConnection connection)
2

          
3
……… (String) this.c.get(keyValue);
4

          
5
}



Set Value: Push data to Memcache with key

Java
 




xxxxxxxxxx
1


 
1
public boolean putKeyValue(@Connection MemcachedConnection connection, String value, int secondsToLive) {
2

          
3
  ……..c.set(keyValue, secondsToLive, value)
4

          
5
}



Memcache Config

Demo Video



Connector (mathematics) Cache (computing)

Published at DZone with permission of Sadik Ali. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Creating a Web Project: Caching for Performance Optimization
  • Designing a Java Connector for Software Integrations
  • Scaling DevOps With NGINX Caching: Reducing Latency and Backend Load
  • Develop a Reverse Proxy With Caching in Go

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!