James

James

  • NA
  • 1
  • 0

Caching data in C# middle tier component for use in VB COM

Jun 18 2006 4:03 PM


I have a c# assembly which i have exposed to a VB COM object.
Within the c# assembly, i implemented a singleton pattern which loads the
cached from the database if the cache is null. This data does not change
often but take long to load so i have cached it.

c#
 private static RuleChecker myInstance;
       private RuleChecker()        //private constructor
       {
           cacheData();
       }
        public static RuleChecker getInstance()
        {
            if (myInstance == null)
                myInstance = new RuleChecker();

            return myInstance;
        }

VB6 - that uses the c# app


Private guideline As Guidelines.RuleCheckerFacade
Private Sub Class_Initialize()
    Set guideline = New Guidelines.RuleCheckerFacade
End Sub

Public Function GetAccounts(ByValid As Long) As Variant

    GetAccounts = guideline.GetAccounts(id)

End Function
However in my VB application, it seem i have to re-cache the data every time
i re-start the VB executable.

I need this cache data to remain cache until  i call a method to refresh it.
Do i have my design wrong? how can i cache data in middle tier object so i use in multiuser COM object ?
Please help.