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

Loading…
Cancel
Save