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
a43e53d7
Commit
a43e53d7
authored
Jul 22, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
⚡
#12319
parent
bafb8e05
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
9 deletions
+11
-9
src/main/java/org/b3log/solo/cache/PreferenceCache.java
src/main/java/org/b3log/solo/cache/PreferenceCache.java
+7
-4
src/main/java/org/b3log/solo/cache/UserCache.java
src/main/java/org/b3log/solo/cache/UserCache.java
+4
-5
No files found.
src/main/java/org/b3log/solo/cache/PreferenceCache.java
View file @
a43e53d7
...
@@ -15,8 +15,11 @@
...
@@ -15,8 +15,11 @@
*/
*/
package
org
.
b3log
.
solo
.
cache
;
package
org
.
b3log
.
solo
.
cache
;
import
org.b3log.latke.cache.Cache
;
import
org.b3log.latke.cache.CacheFactory
;
import
org.b3log.latke.ioc.inject.Named
;
import
org.b3log.latke.ioc.inject.Named
;
import
org.b3log.latke.ioc.inject.Singleton
;
import
org.b3log.latke.ioc.inject.Singleton
;
import
org.b3log.solo.model.Option
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
/**
/**
...
@@ -33,7 +36,7 @@ public class PreferenceCache {
...
@@ -33,7 +36,7 @@ public class PreferenceCache {
/**
/**
* Preference cache.
* Preference cache.
*/
*/
private
JSONObject
preference
;
private
Cache
cache
=
CacheFactory
.
getCache
(
Option
.
CATEGORY_C_PREFERENCE
)
;
/**
/**
* Get the preference.
* Get the preference.
...
@@ -41,7 +44,7 @@ public class PreferenceCache {
...
@@ -41,7 +44,7 @@ public class PreferenceCache {
* @return preference
* @return preference
*/
*/
public
JSONObject
getPreference
()
{
public
JSONObject
getPreference
()
{
return
preference
;
return
cache
.
get
(
Option
.
CATEGORY_C_PREFERENCE
)
;
}
}
/**
/**
...
@@ -50,13 +53,13 @@ public class PreferenceCache {
...
@@ -50,13 +53,13 @@ public class PreferenceCache {
* @param preference the specified preference
* @param preference the specified preference
*/
*/
public
void
putPreference
(
final
JSONObject
preference
)
{
public
void
putPreference
(
final
JSONObject
preference
)
{
this
.
preference
=
preference
;
cache
.
put
(
Option
.
CATEGORY_C_PREFERENCE
,
preference
)
;
}
}
/**
/**
* Clears the preference.
* Clears the preference.
*/
*/
public
void
clear
()
{
public
void
clear
()
{
preference
=
null
;
cache
.
removeAll
()
;
}
}
}
}
src/main/java/org/b3log/solo/cache/UserCache.java
View file @
a43e53d7
...
@@ -16,15 +16,14 @@
...
@@ -16,15 +16,14 @@
package
org
.
b3log
.
solo
.
cache
;
package
org
.
b3log
.
solo
.
cache
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.cache.Cache
;
import
org.b3log.latke.cache.CacheFactory
;
import
org.b3log.latke.ioc.inject.Named
;
import
org.b3log.latke.ioc.inject.Named
;
import
org.b3log.latke.ioc.inject.Singleton
;
import
org.b3log.latke.ioc.inject.Singleton
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.model.User
;
import
org.b3log.solo.util.JSONs
;
import
org.b3log.solo.util.JSONs
;
import
org.json.JSONObject
;
import
org.json.JSONObject
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
/**
* User cache.
* User cache.
*
*
...
@@ -39,12 +38,12 @@ public class UserCache {
...
@@ -39,12 +38,12 @@ public class UserCache {
/**
/**
* Id, User.
* Id, User.
*/
*/
private
static
final
Map
<
String
,
JSONObject
>
ID_CACHE
=
new
ConcurrentHashMap
<>(
);
private
static
final
Cache
ID_CACHE
=
CacheFactory
.
getCache
(
User
.
USERS
+
"ID"
);
/**
/**
* Email, User.
* Email, User.
*/
*/
private
static
final
Map
<
String
,
JSONObject
>
EMAIL_CACHE
=
new
ConcurrentHashMap
<>(
);
private
static
final
Cache
EMAIL_CACHE
=
CacheFactory
.
getCache
(
User
.
USERS
+
"Email"
);
/**
/**
* Gets a user by the specified user id.
* Gets a user by the specified user id.
...
...
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