Skip to content

Commit

Permalink
3.0.4.48
Browse files Browse the repository at this point in the history
3.0.4.48
  • Loading branch information
noear committed Aug 26, 2017
1 parent 66fb95d commit 6908150
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 86 deletions.
110 changes: 52 additions & 58 deletions java/.idea/workspace.xml

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions java/Weed3/src/noear/weed/DbAccess.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public Variate getVariate(Act2<CacheUsing,Variate> cacheCondition) throws SQLExc
rst = new SQLer().getVariate(getCommand(), _tran);
else {
_cache.usingCache(cacheCondition);
rst = _cache.getEx(this.getWeedKey(), () -> (new SQLer().getVariate(getCommand(), _tran)));
rst = _cache.get(this.getWeedKey(), () -> (new SQLer().getVariate(getCommand(), _tran)));
}
if (rst == null)
return new Variate();
Expand All @@ -151,7 +151,7 @@ public <T extends IBinder> T getItem(T model,Act2<CacheUsing,T> cacheCondition)
rst = new SQLer().getItem(getCommand(), _tran, model);
else {
_cache.usingCache(cacheCondition);
rst = _cache.getEx(this.getWeedKey(), () -> (new SQLer().getItem(getCommand(), _tran, model)));
rst = _cache.get(this.getWeedKey(), () -> (new SQLer().getItem(getCommand(), _tran, model)));
}

if(rst == null)
Expand All @@ -172,7 +172,7 @@ public <T extends IBinder> List<T> getList(T model,Act2<CacheUsing,List<T>> cach
else
{
_cache.usingCache(cacheCondition);
rst = _cache.getEx(this.getWeedKey(), () -> (new SQLer().getList(getCommand(), _tran, model)));
rst = _cache.get(this.getWeedKey(), () -> (new SQLer().getList(getCommand(), _tran, model)));
}

if(rst == null)
Expand All @@ -198,7 +198,7 @@ public DataList getDataList(Act2<CacheUsing,DataList> cacheCondition) throws SQL
rst = new SQLer().getTable(getCommand(), _tran);
else {
_cache.usingCache(cacheCondition);
rst = _cache.getEx(this.getWeedKey(), () -> (new SQLer().getTable(getCommand(), _tran)));
rst = _cache.get(this.getWeedKey(), () -> (new SQLer().getTable(getCommand(), _tran)));
}

if(rst == null)
Expand All @@ -219,7 +219,7 @@ public DataItem getDataItem(Act2<CacheUsing,DataList> cacheCondition) throws SQL
rst = new SQLer().getRow(getCommand(), _tran);
else {
_cache.usingCache(cacheCondition);
rst = _cache.getEx(this.getWeedKey(), () -> (new SQLer().getRow(getCommand(), _tran)));
rst = _cache.get(this.getWeedKey(), () -> (new SQLer().getRow(getCommand(), _tran)));
}

if(rst == null)
Expand Down
44 changes: 24 additions & 20 deletions java/Weed3/src/noear/weed/IQuery.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,28 @@
* Created by yuety on 14/11/12.
*/
public interface IQuery {
public long getCount() throws SQLException;
public Object getValue() throws SQLException;
public <T> T getValue(T def) throws SQLException;
public Variate getVariate() throws SQLException;
public Variate getVariate(Act2<CacheUsing,Variate> cacheCondition) throws SQLException;
public <T extends IBinder> T getItem(T model) throws SQLException;
public <T extends IBinder> T getItem(T model, Act2<CacheUsing, T> cacheCondition) throws SQLException;
public <T extends IBinder> List<T> getList(T model) throws SQLException;
public <T extends IBinder> List<T> getList(T model, Act2<CacheUsing, List<T>> cacheCondition) throws SQLException;
public DataList getDataList() throws SQLException;
public DataList getDataList(Act2<CacheUsing, DataList> cacheCondition) throws SQLException;
public DataItem getDataItem() throws SQLException;
public DataItem getDataItem(Act2<CacheUsing, DataList> cacheCondition) throws SQLException;

public <T> List<T> getArray(String column) throws SQLException;

public IQuery caching(ICacheService service);
public IQuery usingCache(boolean isCache);
public IQuery usingCache(int seconds);
public IQuery cacheTag(String tag);
long getCount() throws SQLException;
Object getValue() throws SQLException;
<T> T getValue(T def) throws SQLException;

Variate getVariate() throws SQLException;
Variate getVariate(Act2<CacheUsing,Variate> cacheCondition) throws SQLException;

<T extends IBinder> T getItem(T model) throws SQLException;
<T extends IBinder> T getItem(T model, Act2<CacheUsing, T> cacheCondition) throws SQLException;

<T extends IBinder> List<T> getList(T model) throws SQLException;
<T extends IBinder> List<T> getList(T model, Act2<CacheUsing, List<T>> cacheCondition) throws SQLException;

DataList getDataList() throws SQLException;
DataList getDataList(Act2<CacheUsing, DataList> cacheCondition) throws SQLException;
DataItem getDataItem() throws SQLException;
DataItem getDataItem(Act2<CacheUsing, DataList> cacheCondition) throws SQLException;

<T> List<T> getArray(String column) throws SQLException;

IQuery caching(ICacheService service);
IQuery usingCache(boolean isCache);
IQuery usingCache(int seconds);
IQuery cacheTag(String tag);
}
6 changes: 3 additions & 3 deletions java/Weed3/src/noear/weed/cache/CacheUsing.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public CacheUsing(ICacheService cache) {
/// <param name="exec">执行方法</param>
/// <param name="weedKey">缓存关健字</param>
/// <returns></returns>
public <T> T get(String weedKey, Fun0<T> exec) {
/*public <T> T get(String weedKey, Fun0<T> exec) {
if (this.cacheController == CacheState.NonUsing)
return exec.run();
Expand Down Expand Up @@ -113,9 +113,9 @@ public <T> T get(String weedKey, Fun0<T> exec) {
onExecH.run();
return cacheT;
}
}*/

public <T> T getEx(String weedKey, Fun0Ex<T,SQLException> exec) throws SQLException{
public <T> T get(String weedKey, Fun0Ex<T,SQLException> exec) throws SQLException{
if (this.cacheController == CacheState.NonUsing)
return exec.run();

Expand Down
Binary file modified java/out/production/Weed3/noear/weed/DbAccess.class
Binary file not shown.
Binary file modified java/out/production/Weed3/noear/weed/cache/CacheUsing.class
Binary file not shown.

0 comments on commit 6908150

Please sign in to comment.