Heroku Redis Key Eviction Policy

Redis has a maxmemory-policy where it decides how to handle keys when memory limit is reached. noeviction will return errors when the memory limit is reached. allkeys-lru will remove less recently used keys first. volatile-lru will remove less recently used keys first that have an expiry set. allkeys-random will evict random keys. volatile-random will evict … Read more

Vuex Two Way Data Binding

I was having trouble understanding the work-flow and boilerplate of using Vuex state in my components. This article by Markus Oberlehner helped me understand how to bind elements to the state and how to use vuex-map-fields to simplify the process. Here’s the manual way. Read his post to find out about vuex-map-fields https://markus.oberlehner.net/blog/form-fields-two-way-data-binding-and-vuex/

Composer Memory Limit Reached

You got an error. A composer memory limit error. You go to the documentation. It tells you to search through your PHP ini files and increase the memory limit. You realize that’s going to take a while depending on what env you’re using. You’d rather just copy and paste a command in the terminal. This … Read more

Postgres Delete Duplicate Rows

This query is to delete duplicate rows on multiple selected columns for Postgres. Just plug in the table_name and columns you want to evaluate duplicates on. This query is the fastest out of several I’ve tried, evaluating and deleting 5 million duplicate rows on 8 columns in about 20 seconds.

Carbon:: First and Last Day of Previous Month

You know you have to query last month’s records all the time (instead of the last 30 days). Here’s how to get those numbers easily with Carbon. We do the extra fancy footwork for the end of the month to avoid simply getting the same last date of the month for the previous month.

Create Index in Postgres

If your query is forcing the db to search through millions of rows to fetch data, indexing a table can help improve performance. Here’s how to do it on Postgres. ELI5 Index If you’re actually five you probably haven’t seen one of those indexes in wooden box that you saw at public libraries, but it … Read more