Skip to content

Add redis caching#13

Merged
taras merged 4 commits into
masterfrom
add-redis
Jan 9, 2017
Merged

Add redis caching#13
taras merged 4 commits into
masterfrom
add-redis

Conversation

@taras
Copy link
Copy Markdown
Contributor

@taras taras commented Jan 8, 2017

When a user landed on contributordays.com, there was a slight delay while Fastboot rendered the page. This PR adds page caching with using Redis. I created a free account on redislabs.com which I'm using for Redis hosting.

To get Redis hooked up, I used fastboot-redis-cache which is a middleware that I added in server.js.

redislabs requires a password. fastboot-redis-cache didn't support providing a password, so I created a fork on https://github.com/taras/fastboot-redis-cache/tree/add-password-option and a PR to fastboot-redis-cache

To store password securely, I used git-crypt which automatically encrypt and decrypts server/config.json on checkout and commit. You have to install git-crypt to deploy the server.

I moved all of the configurations into config.json.

@taras
Copy link
Copy Markdown
Contributor Author

taras commented Jan 9, 2017

@jorgelainfiesta did you see this?

@jorgelainfiesta
Copy link
Copy Markdown
Contributor

@taras yep, it's quite interesting. I'm not very familiar with redis, but I think I got what it does.

@taras
Copy link
Copy Markdown
Contributor Author

taras commented Jan 9, 2017

It's an in-memory key value store. Think of it as a database that only stores data based on key and it's corresponding value. So, foo: bar. You can get('foo') and set('foo', 'some value'). It's very fast because the values are stored in memory. It's intended to be primarily fast and not permanent. You should only put into it values that you're not afraid to loose. The combination of speed and impermanence makes it perfect for caching scenarios.

@taras taras merged commit 443a1e1 into master Jan 9, 2017
@taras taras deleted the add-redis branch January 9, 2017 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants