Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

知识管理咨询师 sheldonshen

🎯
Focusing
View GitHub Profile
View Redis vs Memcache.md

When deciding between Memcached and Redis, here are a few questions to consider:

  • Is object caching your primary goal, for example to offload your database? If so, use Memcached.
  • Are you interested in as simple a caching model as possible? If so, use Memcached.
  • Are you planning on running large cache nodes, and require multithreaded performance with utilization of multiple cores? If so, use Memcached.
  • Do you want the ability to scale your cache horizontally as you grow? If so, use Memcached.
  • Does your app need to atomically increment or decrement counters? If so, use either Redis or Memcached.
  • Are you looking for more advanced data types, such as lists, hashes, and sets? If so, use Redis.
  • Does sorting and ranking datasets in memory help you, such as with leaderboards? If so, use Redis.
  • Are publish a
View open-source-search-compare.md
@sheldonshen
sheldonshen / FuturesA.java
Created Jul 24, 2017 — forked from benjchristensen/FuturesA.java
FuturesA.java Simple example of using Futures.
View FuturesA.java
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class FuturesA {
public static void run() throws Exception {
@sheldonshen
sheldonshen / FuturesB.java
Created Jul 24, 2017 — forked from benjchristensen/FuturesB.java
FuturesB.java Example of using Futures for nested calls showing how it blocks inefficiently.
View FuturesB.java
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@sheldonshen
sheldonshen / css-selectors.md
Created Jun 26, 2017 — forked from magicznyleszek/css-selectors.md
CSS Selectors Cheatsheet
View css-selectors.md

CSS Selectors Cheatsheet

Element selectors

Element -- selects all h2 elements on the page

h2 {
    foo: bar;
View StreamUtil.java
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.function.BiFunction;
import java.util.stream.LongStream;
import java.util.stream.Stream;
/**
*
*/
@sheldonshen
sheldonshen / RandomCodeServlet.java
Created Aug 2, 2016
image validation code generation
View RandomCodeServlet.java
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;