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

  • Home
  • SEARCH
  • 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 951001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:39:34+00:00 2026-05-15T23:39:34+00:00

I have a datastore with a cache and a db, simple. The tricksy part

  • 0

I have a datastore with a cache and a db, simple. The tricksy part is that I want a way to control if the the datastore hits the db in a real-time way. That is to say while the process is running I want to be able to toggle if it’s connected to the db or not.

I looked into env variables, but it doesn’t seem like those get updated as the process runs. Is there a simple way to get a bit from the command line into the running process, or do I just need to rely on ops being able to drop the db listeners in case of disaster?

Note that this is all being done in vanilla ruby – not ruby on rails.

Thanks!
-Jess

  • 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-15T23:39:34+00:00Added an answer on May 15, 2026 at 11:39 pm

    I think you can use named pipes for simple communication:

    #pipes.rb:
    f = File.open 'mypipe', 'r+'
    loop do
      begin
        s = f.read_nonblock 1
      rescue Exception
      end
      case s
      when '0'
        puts 'Turn off DB access!'
      when '1'
        puts 'Turn on DB access!'
      end
      sleep 1
    end
    

    And you can control your db access externally by writing to the named pipe:

    jablan-mbp:dev $ echo 101 > mypipe 
    

    Which results in:

    jablan-mbp:dev $ ruby pipes.rb 
    Turn on DB access!
    Turn off DB access!
    Turn on DB access!
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a multi column datastore on a table that allows me to
I have a new web app that is packaged as a WAR as part
In a redis datastore I have a list of keys, I want to iterate
Since there is no way to join tables using Google App Engine datastore, I
I have datastore Model bellow: class ThisCategory(search.SearchableModel): ancestor = db.ListProperty(db.Key, default=[]) no_ancestor = db.BooleanProperty(default=True)
For all my data in the GAE Datastore I have a model for keeping
App Engine Datastore cannot be queried for an aggregate result. Example: I have an
The app engine datastore, of course, has downtime . However, I'd like to have
I have a project that adds elements to an AutoCad drawing. I noticed that
I have a script that appends some rows to a table. One of the

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.