Barebones model of Spotify's 'Recently Played' screen using a Least Recently Used (LRU) cache in Golang

One of the most used caching schemes is Least Recently Used (LRU). Caches that use this eviction strategy will remove the least recently used item when their size reaches their capacity. That means that such caches have to keep a track of the order of access of the cached items, so it would evict the correct items. Before we go too much into details about the implementation of an LRU cache, let’s first see what are the possible applications of this caching scheme....

March 11, 2019 · 12 min · Ilija

When and Why to use a Least Frequently Used (LFU) cache with an implementation in Golang

Over the years, people involved in computer science and engineering have worked really hard on optimisations of various natures. Given that we live in a world with limited resources, humanity has always worked on ways to optimise the costs and speed literally everything. In software engineering, I would argue, the most popular approach to performance improvement is caching. While there are various applications of caching, depending on the area of software engineering, the idea behind caching is quite simple: store data that is often needed/used in fast structure/storage so it can be retrieved very fast....

February 27, 2019 · 16 min · Ilija

Golang Datastructures: Trees

You can spend quite a bit of your programming career without working with trees, or just by simply avoiding them if you don’t understand them (which is what I had been doing for a while). Now, don’t get me wrong - arrays, lists, stacks and queues are quite powerful data structures and can take you pretty far, but there is a limit to their capabilities, how you can use them and how efficient that usage can be....

February 13, 2019 · 14 min · Ilija

Data structures in Go: Stacks and queues

In a previous post1, we took a look at linked lists and how we can apply them in a hypothetical use-case. In this post, we will look at two similar but powerful data structures. Modelling actions and history Think about Excel or Google docs. You know, the most ubiquitous applications for composing documents that humanity has invented. We’ve all used them in some capacity. As you might know, these apps come with various actions one can apply to a text....

February 24, 2018 · 12 min · Ilija

Data structures in Go: Linked lists

Data structures and algorithms are the bread and butter of computer science. Although sometimes they appear scary to people, most of them have a simple explanation. Also, when explained well with a problem algorithms can be interesting and fun to learn and apply. This post is aimed at people that are not comfortable with linked lists, or folks that want to see and learn how to build one with Golang....

February 18, 2018 · 14 min · Ilija