Skip to content

Instantly share code, notes, and snippets.

View fwrq41251's full-sized avatar

winry fwrq41251

View GitHub Profile
@fwrq41251
fwrq41251 / start.sh
Created February 29, 2016 05:54
start and stop java application from shell.
#!/bin/sh
SERVICE_NAME=MyService
PATH_TO_JAR=/usr/local/MyProject/MyJar.jar
PID_PATH_NAME=/tmp/MyService-pid
case $1 in
start)
echo "Starting $SERVICE_NAME ..."
if [ ! -f $PID_PATH_NAME ]; then
nohup java -jar $PATH_TO_JAR /tmp 2>> /dev/null >> /dev/null &
echo $! > $PID_PATH_NAME
@fwrq41251
fwrq41251 / ShiroRedisCache.java
Last active February 19, 2016 01:53
shiro cache impl in redis.
import java.util.Collection;
import java.util.List;
import java.util.Set;
import org.apache.shiro.cache.Cache;
import org.apache.shiro.cache.CacheException;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.SetOperations;
public class ShiroRedisCache<K, V> implements Cache<K, V> {