Guava Cache with Java 8 Lambdas

Today I needed to cache some values in memory in an application that does a lot of json parsing and I tought that Guava Cache would be nice for that. Creating the cache To create the cache we use a CacheBuilder and setup the properties in it. private static final Cache<Integer, String> cache = CacheBuilder.newBuilder() .weakValues() .maximumSize(CACHE_SIZE) .build( new CacheLoader<Integer, String>() { @Override public String load(Integer key) throws Exception { return "my computed value"; } }); Sounds a little bit verbose, maybe we can use Jaba 8 lambdas instead of the CacheLoader?
Read more

Running PostgreSQL through Docker

I’ve been using Docker to run PostgreSQL server and I think it is much simplier than installing it natively. Creating container docker run --name postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -v /home/user/postgres/data:/var/lib/postgresql/data -d postgres Note: You can customize /home/users/postgres/data directory Starting server sudo docker start postgres Stopping server sudo docker stop postgres

Fish Shell

Fish is very simple and nicely interative shell. I’ve been using it for the past 6 months and it has replaced ZSH totally. Here are some of the nicest features i found. Auto complete for everithing: You can just tab in your terminal and it will bring to you sugestions. Man integration: It shows all options that are documented on man (help) about the command. Lots of plugins: I installed oh-my-fish and kubernetes plugins.
Read more