Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery.common.java
/
utils
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
22a39522
authored
Jul 12, 2016
by
amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
ver 1.1.1 taking redis host port from env
parent
7227f61b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
build.gradle
src/main/java/common/RedisCacheClient.java
build.gradle
View file @
22a39522
group
'com.ipgallery.common'
version
'1.1.
0
'
version
'1.1.
1
'
apply
plugin:
'java'
apply
plugin:
'maven-publish'
...
...
@@ -19,7 +19,6 @@ dependencies {
compile
'com.fasterxml.jackson.core:jackson-databind:2.2.3'
compile
'com.googlecode.libphonenumber:libphonenumber:5.8'
compile
group:
'com.google.gdata'
,
name:
'core'
,
version:
'1.47.1'
// compile 'com.google.gdata:gdata-core-1.0:1.36.0'
compile
'org.apache.httpcomponents:httpclient:4.1'
compile
'org.apache.httpcomponents:httpmime:4.1'
compile
'javax.ws.rs:javax.ws.rs-api:2.0'
...
...
src/main/java/common/RedisCacheClient.java
View file @
22a39522
...
...
@@ -11,10 +11,14 @@ public class RedisCacheClient implements CacheClient
private
static
int
CACHE_EXPIRATION_TIMEOUT
;
public
static
int
INITIAL_CAPACITY
=
64
;
private
static
int
DEFAULT_REDIS_DATABASE_INDEX
;
private
static
final
String
REDIS_PORT
;
private
static
final
String
REDIS_IP_ADDRESS
;
static
{
CACHE_EXPIRATION_TIMEOUT
=
Integer
.
valueOf
(
System
.
getProperty
(
"cache.expiration.timeout"
,
"300"
)).
intValue
();
DEFAULT_REDIS_DATABASE_INDEX
=
Integer
.
valueOf
(
System
.
getProperty
(
"cache.redis.database.index.timeout"
,
"1"
)).
intValue
();
REDIS_IP_ADDRESS
=
System
.
getProperty
(
"redis.host"
,
"localhost"
);
REDIS_PORT
=
System
.
getProperty
(
"redis.port"
,
"6379"
);
}
private
JedisPool
jedisPool
=
null
;
...
...
@@ -22,22 +26,22 @@ public class RedisCacheClient implements CacheClient
public
RedisCacheClient
()
{
initPool
(
"localhost"
);
initPool
(
REDIS_IP_ADDRESS
,
Integer
.
valueOf
(
REDIS_PORT
).
intValue
()
);
}
public
RedisCacheClient
(
String
host
)
{
initPool
(
host
);
initPool
(
host
,
Integer
.
valueOf
(
REDIS_PORT
)
);
}
private
void
initPool
(
String
host
)
{
private
void
initPool
(
String
host
,
int
port
)
{
JedisPoolConfig
jedisPoolConfig
=
new
JedisPoolConfig
();
jedisPoolConfig
.
setMaxTotal
(
200
);
jedisPoolConfig
.
setMaxIdle
(
100
);
jedisPoolConfig
.
setMinIdle
(
50
);
jedisPoolConfig
.
setTestWhileIdle
(
true
);
jedisPoolConfig
.
setMaxWaitMillis
(
500
);
jedisPool
=
new
JedisPool
(
jedisPoolConfig
,
host
);
jedisPool
=
new
JedisPool
(
jedisPoolConfig
,
host
,
port
);
}
private
Jedis
getJedis
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment