Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6622893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:27:56+00:00 2026-05-25T21:27:56+00:00

I have a Sinatra app on Heroku and I fetch data from many 3rd

  • 0

I have a Sinatra app on Heroku and I fetch data from many 3rd party APIs and store it in memcache, to speed up load time.

But the data is not updating: the data that is loaded in the first time after enabling the plugin stays in the memcache all the time and it does not expire.

Here are parts of my code:

set :cache, Dalli:client.new

configure do
    set :cache_default_expiry, 300
end    

def get_apidata()
    apidata = settings.cache.get('apidata')  
    if apidatadata.nil?
       # getting data from API
       settings.cache.set('apidata',apidata)

Where is problem in my code, why isn’t cached data expiring?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T21:27:56+00:00Added an answer on May 25, 2026 at 9:27 pm

    From my tests set :cache_default_expiry does not work. What you can do instead is this:

    set :cache, Dalli::Client.new(ENV['MEMCACHE_SERVERS'],
                                 :username => ENV['MEMCACHE_USERNAME'],
                                 :password => ENV['MEMCACHE_PASSWORD'],
                                 :expires_in => 300)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple sinatra app on Heroku which fetches some json data and
In my sinatra app i have a form which is used to submit data
I have a basic Sinatra app deployed to Heroku. I have 'enable :sessions' in
Have my app up on Heroku. Using rack-canonical-host to handle re-directs from myapp.heroku.com to
From what I can tell if I have my app on Heroku and use
I have a small Sinatra app which generates html fragments for me from an
I have a Sinatra app I plan on hosting on Heroku. This application, in
I have a sinatra app running on heroku. My problem: I always get redirected
I have a sinatra ruby app in heroku. I am trying to access the
I have this route in my Sinatra app: post ':type/new' do data = JSON.parse

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.