Guilhermevrs
Guilhermevrs

Reputation: 2344

Ruby on Rails - How to manage multiple access to shared file

I am quite new to Rails and I need to implement a project for my University. This project consists of a website that will use a binary file as database.

So I need to know a thread safe way to read and write this file, taking into consideration that the same file (database) will be used by multiple process (each time someone access the site, it should read and write data into the file).

Thanks in advance

Upvotes: 3

Views: 242

Answers (1)

Brad Werth
Brad Werth

Reputation: 17647

There really isn't a graceful way to handle that. You're much better off taking a more traditional approach, with a SQL server like mySQL or PostgreSQL, which do basically that same thing.

Edit:

I didn't realize you could use sqlite in multi-threaded mode. That would seem to satisfy both requirements...

Upvotes: 3

Related Questions