Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
fcd76d3c
Commit
fcd76d3c
authored
Aug 30, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12319 命名重构
parent
6bcd7fe9
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
38 deletions
+22
-38
src/main/java/org/b3log/solo/cache/ArticleCache.java
src/main/java/org/b3log/solo/cache/ArticleCache.java
+4
-8
src/main/java/org/b3log/solo/cache/CommentCache.java
src/main/java/org/b3log/solo/cache/CommentCache.java
+1
-5
src/main/java/org/b3log/solo/cache/OptionCache.java
src/main/java/org/b3log/solo/cache/OptionCache.java
+1
-5
src/main/java/org/b3log/solo/cache/PageCache.java
src/main/java/org/b3log/solo/cache/PageCache.java
+4
-8
src/main/java/org/b3log/solo/cache/UserCache.java
src/main/java/org/b3log/solo/cache/UserCache.java
+12
-12
No files found.
src/main/java/org/b3log/solo/cache/ArticleCache.java
View file @
fcd76d3c
...
...
@@ -38,11 +38,7 @@ public class ArticleCache {
/**
* Article cache.
*/
private
static
final
Cache
ARTICLE_CACHE
=
CacheFactory
.
getCache
(
Article
.
ARTICLES
);
static
{
ARTICLE_CACHE
.
setMaxCount
(
128
);
}
private
Cache
cache
=
CacheFactory
.
getCache
(
Article
.
ARTICLES
);
/**
* Gets an article by the specified article id.
...
...
@@ -51,7 +47,7 @@ public class ArticleCache {
* @return article, returns {@code null} if not found
*/
public
JSONObject
getArticle
(
final
String
id
)
{
final
JSONObject
article
=
ARTICLE_CACHE
.
get
(
id
);
final
JSONObject
article
=
cache
.
get
(
id
);
if
(
null
==
article
)
{
return
null
;
}
...
...
@@ -67,7 +63,7 @@ public class ArticleCache {
public
void
putArticle
(
final
JSONObject
article
)
{
final
String
articleId
=
article
.
optString
(
Keys
.
OBJECT_ID
);
ARTICLE_CACHE
.
put
(
articleId
,
JSONs
.
clone
(
article
));
cache
.
put
(
articleId
,
JSONs
.
clone
(
article
));
}
/**
...
...
@@ -76,6 +72,6 @@ public class ArticleCache {
* @param id the specified article id
*/
public
void
removeArticle
(
final
String
id
)
{
ARTICLE_CACHE
.
remove
(
id
);
cache
.
remove
(
id
);
}
}
\ No newline at end of file
src/main/java/org/b3log/solo/cache/CommentCache.java
View file @
fcd76d3c
...
...
@@ -38,11 +38,7 @@ public class CommentCache {
/**
* Comment cache.
*/
private
static
final
Cache
cache
=
CacheFactory
.
getCache
(
Comment
.
COMMENTS
);
static
{
cache
.
setMaxCount
(
512
);
}
private
Cache
cache
=
CacheFactory
.
getCache
(
Comment
.
COMMENTS
);
/**
* Gets a comment by the specified comment id.
...
...
src/main/java/org/b3log/solo/cache/OptionCache.java
View file @
fcd76d3c
...
...
@@ -38,11 +38,7 @@ public class OptionCache {
/**
* Option cache.
*/
private
static
final
Cache
CACHE
=
CacheFactory
.
getCache
(
Option
.
OPTIONS
);
static
{
CACHE
.
setMaxCount
(
512
);
}
private
Cache
CACHE
=
CacheFactory
.
getCache
(
Option
.
OPTIONS
);
/**
* Gets an option by the specified option id.
...
...
src/main/java/org/b3log/solo/cache/PageCache.java
View file @
fcd76d3c
...
...
@@ -38,11 +38,7 @@ public class PageCache {
/**
* Page cache.
*/
private
static
final
Cache
PAGE_CACHE
=
CacheFactory
.
getCache
(
Page
.
PAGES
);
static
{
PAGE_CACHE
.
setMaxCount
(
128
);
}
private
Cache
cache
=
CacheFactory
.
getCache
(
Page
.
PAGES
);
/**
* Gets a page by the specified page id.
...
...
@@ -51,7 +47,7 @@ public class PageCache {
* @return page, returns {@code null} if not found
*/
public
JSONObject
getPage
(
final
String
id
)
{
final
JSONObject
page
=
PAGE_CACHE
.
get
(
id
);
final
JSONObject
page
=
cache
.
get
(
id
);
if
(
null
==
page
)
{
return
null
;
}
...
...
@@ -67,7 +63,7 @@ public class PageCache {
public
void
putPage
(
final
JSONObject
page
)
{
final
String
pageId
=
page
.
optString
(
Keys
.
OBJECT_ID
);
PAGE_CACHE
.
put
(
pageId
,
JSONs
.
clone
(
page
));
cache
.
put
(
pageId
,
JSONs
.
clone
(
page
));
}
/**
...
...
@@ -76,6 +72,6 @@ public class PageCache {
* @param id the specified page id
*/
public
void
removePage
(
final
String
id
)
{
PAGE_CACHE
.
remove
(
id
);
cache
.
remove
(
id
);
}
}
src/main/java/org/b3log/solo/cache/UserCache.java
View file @
fcd76d3c
...
...
@@ -39,17 +39,17 @@ public class UserCache {
/**
* Id, User.
*/
private
static
final
Cache
ID_CACHE
=
CacheFactory
.
getCache
(
User
.
USERS
+
"ID"
);
private
Cache
idCache
=
CacheFactory
.
getCache
(
User
.
USERS
+
"ID"
);
/**
* Email, User.
*/
private
static
final
Cache
EMAIL_CACHE
=
CacheFactory
.
getCache
(
User
.
USERS
+
"Email"
);
private
Cache
emailCache
=
CacheFactory
.
getCache
(
User
.
USERS
+
"Email"
);
/**
* Admin user.
*/
private
static
final
Cache
ADMIN_CACHE
=
CacheFactory
.
getCache
(
"adminUser"
);
private
Cache
adminCache
=
CacheFactory
.
getCache
(
"adminUser"
);
/**
* Gets the admin user.
...
...
@@ -57,7 +57,7 @@ public class UserCache {
* @return admin user
*/
public
JSONObject
getAdmin
()
{
return
ADMIN_CACHE
.
get
(
Role
.
ADMIN_ROLE
);
return
adminCache
.
get
(
Role
.
ADMIN_ROLE
);
}
/**
...
...
@@ -66,7 +66,7 @@ public class UserCache {
* @param admin the specified admin user
*/
public
void
putAdmin
(
final
JSONObject
admin
)
{
ADMIN_CACHE
.
put
(
Role
.
ADMIN_ROLE
,
admin
);
adminCache
.
put
(
Role
.
ADMIN_ROLE
,
admin
);
}
/**
...
...
@@ -76,7 +76,7 @@ public class UserCache {
* @return user, returns {@code null} if not found
*/
public
JSONObject
getUser
(
final
String
userId
)
{
final
JSONObject
user
=
ID_CACHE
.
get
(
userId
);
final
JSONObject
user
=
idCache
.
get
(
userId
);
if
(
null
==
user
)
{
return
null
;
}
...
...
@@ -91,7 +91,7 @@ public class UserCache {
* @return user, returns {@code null} if not found
*/
public
JSONObject
getUserByEmail
(
final
String
userEmail
)
{
final
JSONObject
user
=
EMAIL_CACHE
.
get
(
userEmail
);
final
JSONObject
user
=
emailCache
.
get
(
userEmail
);
if
(
null
==
user
)
{
return
null
;
}
...
...
@@ -105,8 +105,8 @@ public class UserCache {
* @param user the specified user
*/
public
void
putUser
(
final
JSONObject
user
)
{
ID_CACHE
.
put
(
user
.
optString
(
Keys
.
OBJECT_ID
),
JSONs
.
clone
(
user
));
EMAIL_CACHE
.
put
(
user
.
optString
(
User
.
USER_EMAIL
),
JSONs
.
clone
(
user
));
idCache
.
put
(
user
.
optString
(
Keys
.
OBJECT_ID
),
JSONs
.
clone
(
user
));
emailCache
.
put
(
user
.
optString
(
User
.
USER_EMAIL
),
JSONs
.
clone
(
user
));
}
/**
...
...
@@ -115,14 +115,14 @@ public class UserCache {
* @param id the specified user id
*/
public
void
removeUser
(
final
String
id
)
{
final
JSONObject
user
=
ID_CACHE
.
get
(
id
);
final
JSONObject
user
=
idCache
.
get
(
id
);
if
(
null
==
user
)
{
return
;
}
ID_CACHE
.
remove
(
id
);
idCache
.
remove
(
id
);
final
String
email
=
user
.
optString
(
User
.
USER_EMAIL
);
EMAIL_CACHE
.
remove
(
email
);
emailCache
.
remove
(
email
);
}
}
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