数据库缓存更新

This commit is contained in:
hoteas 2018-04-09 20:10:58 +00:00
parent 7700ba7658
commit 58ab6ef01f
2 changed files with 36 additions and 27 deletions

60
.idea/workspace.xml generated
View File

@ -6,7 +6,6 @@
<component name="ChangeListManager">
<list default="true" readonly="true" id="03ed5703-81a1-441b-849c-c426276586b7" name="Default" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/db.go" afterPath="$PROJECT_DIR$/db.go" />
<change beforePath="$PROJECT_DIR$/example/main.go" afterPath="$PROJECT_DIR$/example/main.go" />
</list>
<ignored path=".idea/dataSources.local.xml" />
@ -25,11 +24,11 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="main.go" pinned="false" current-in-tab="false">
<file leaf-file-name="main.go" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<state relative-caret-position="285">
<caret line="55" column="59" lean-forward="true" selection-start-line="55" selection-start-column="59" selection-end-line="55" selection-end-column="59" />
<folding>
<element signature="e#14#209#0" expanded="true" />
</folding>
@ -51,7 +50,7 @@
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="14" lean-forward="true" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
<caret line="12" column="14" lean-forward="false" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
<folding>
<element signature="e#15#106#0" expanded="true" />
</folding>
@ -63,7 +62,7 @@
<entry file="file://$PROJECT_DIR$/cache_memory.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="19" column="18" lean-forward="true" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
<caret line="19" column="18" lean-forward="false" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
<folding />
</state>
</provider>
@ -79,11 +78,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="db.go" pinned="false" current-in-tab="true">
<file leaf-file-name="db.go" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="13" lean-forward="false" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
<state relative-caret-position="105">
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
<folding />
</state>
</provider>
@ -200,8 +199,8 @@
<option value="$PROJECT_DIR$/cache_memory.go" />
<option value="$PROJECT_DIR$/cache_db.go" />
<option value="$PROJECT_DIR$/cache/cache_redis.go" />
<option value="$PROJECT_DIR$/example/main.go" />
<option value="$PROJECT_DIR$/db.go" />
<option value="$PROJECT_DIR$/example/main.go" />
</list>
</option>
</component>
@ -478,7 +477,7 @@
<workItem from="1522778659126" duration="455000" />
<workItem from="1522779789231" duration="6991000" />
<workItem from="1523202491878" duration="853000" />
<workItem from="1523288830673" duration="5111000" />
<workItem from="1523288830673" duration="6206000" />
</task>
<task id="LOCAL-00001">
<created>1500458878821</created>
@ -690,11 +689,18 @@
<option name="project" value="LOCAL" />
<updated>1523294190912</updated>
</task>
<option name="localTasksCounter" value="31" />
<task id="LOCAL-00031" summary="数据库缓存更新">
<created>1523294232321</created>
<option name="number" value="00031" />
<option name="presentableId" value="LOCAL-00031" />
<option name="project" value="LOCAL" />
<updated>1523294232321</updated>
</task>
<option name="localTasksCounter" value="32" />
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="106634000" />
<option name="totallyTimeSpent" value="107729000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
@ -710,12 +716,13 @@
<editor active="true" />
<layout>
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32846716" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32911393" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.328125" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.328125" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.6322917" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32805908" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
@ -734,7 +741,6 @@
<window_info id="Execute Anonymous" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Salesforce" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32911393" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
@ -1038,7 +1044,7 @@
<entry file="file://$PROJECT_DIR$/cache/cache_redis.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="180">
<caret line="12" column="14" lean-forward="true" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
<caret line="12" column="14" lean-forward="false" selection-start-line="12" selection-start-column="14" selection-end-line="12" selection-end-column="14" />
<folding>
<element signature="e#15#106#0" expanded="true" />
</folding>
@ -1048,7 +1054,7 @@
<entry file="file://$PROJECT_DIR$/cache_memory.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="225">
<caret line="19" column="18" lean-forward="true" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
<caret line="19" column="18" lean-forward="false" selection-start-line="19" selection-start-column="18" selection-end-line="19" selection-end-column="18" />
<folding />
</state>
</provider>
@ -1069,23 +1075,23 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="7" column="13" lean-forward="false" selection-start-line="7" selection-start-column="13" selection-end-line="7" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/main.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="165">
<caret line="11" column="1" lean-forward="true" selection-start-line="11" selection-start-column="1" selection-end-line="11" selection-end-column="1" />
<state relative-caret-position="285">
<caret line="55" column="59" lean-forward="true" selection-start-line="55" selection-start-column="59" selection-end-line="55" selection-end-column="59" />
<folding>
<element signature="e#14#209#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/db.go">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="120">
<caret line="8" column="13" lean-forward="false" selection-start-line="8" selection-start-column="13" selection-end-line="8" selection-end-column="13" />
<folding />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -49,6 +49,9 @@ func main() {
}
return DB
})
//内存缓存数据库数据,错误则删除
// appIns.Db.CacheIns=hotime.CacheIns(&hotime.CacheMemory{})
appIns.SetSession(hotime.CacheIns(&hotime.CacheMemory{}), hotime.CacheIns(&hotime.CacheDb{Db: &appIns.Db, Time: appIns.Config.GetInt64("cacheTime")}))
appIns.SetCache(hotime.CacheIns(&hotime.CacheMemory{}))