Post.latestRevision is cached now

main
Inga 🏳‍🌈 13 years ago
parent 23e08a88f3
commit 3e6cc1ad8f
  1. 2
      Builder/IISMainHandler/build.txt
  2. 15
      FLocal.Common/dataobjects/Post.cs

@ -28,7 +28,10 @@ namespace FLocal.Common.dataobjects {
public static readonly TableSpec instance = new TableSpec();
public string name { get { return TABLE; } }
public string idName { get { return FIELD_ID; } }
public void refreshSqlObject(int id) { Refresh(id); }
public void refreshSqlObject(int id) {
Refresh(id);
LoadById(id).latestRevision_Reset();
}
}
protected override ISqlObjectTableSpec table { get { return TableSpec.instance; } }
@ -70,9 +73,13 @@ namespace FLocal.Common.dataobjects {
return this._revision;
}
}
private readonly object latestRevision_locker = new object();
public Revision latestRevision {
get {
return Revision.LoadById(
return Cache<Revision>.instance.get(
this.latestRevision_locker,
() => Revision.LoadById(
int.Parse(
Config.instance.mainConnection.LoadIdsByConditions(
Revision.TableSpec.instance,
@ -92,9 +99,13 @@ namespace FLocal.Common.dataobjects {
Diapasone.unlimited
).Single()
)
)
);
}
}
internal void latestRevision_Reset() {
Cache<Revision>.instance.delete(this.latestRevision_locker);
}
private int _layerId;
public int layerId {

Loading…
Cancel
Save