Sunday, July 1, 2018

Redis cache store expiry, faster record instantation and more!

Posted by kaspth

Hey there, detective! Here’s Kasper fumbling through his own trenchcoat for his notebook to give you what went down on the Rails codebase this week.

Redis cache store: increment/decrement expiry

If you’ve been looking to expire a key, either when incrementing or decrementing it, with Rails 5.2s Redis cache store. Just pass _expires_in _to make the key sleep with the fishes.

Guides digging almost too deep

The Rails guides are vast and deep. There’s so many that the digging deeper section almost dug its own grave. But splitting out into another section is a saving grace. Why not look through the current guides?

has_secure_password takes an attribute

For many years has_secure_password only allowed a default password attribute. But now you can stash whatever you want in there.

Reduce record instantiation allocations

Instantiating a list of Active Record objects is now faster and allocates less. If the array has the same instances that is. It’s made possible by not looking up the same STI column each time through the loop. 

OS X ditched for macOS

In lighter documentation news the old Mac OS X spelling has been replaced by macOS where applicable.

Multiple exceptions for retry_on/discard_on

Rails 5.1s syntactic sugar for retry_job, retry_on and discard_on that is, only took one exception so you’d have to duplicate exception blocks or spread a retry on multiple lines. No longer! Get your high in a single line of sugar.

20 people contributed to Rails this past week. There might be some open issues you can try tackling?

See you next week!