GAC - Context - Cache

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Prad

    GAC - Context - Cache

    Newbie question related to assemblies in GAC

    If I have a business component in the GAC, and the component uses some
    context (say it is a windows application ... and so i manually set up a

    context ) ...to cache some variables. Will this cache be long-lived and

    shared across all sharing applications?


    Also if I have some static constructors in some of the classes, when
    will they be invoked -- do the normal rules apply here too that they
    will be invoked only the first time any shared assembly tries to access

    them ?

  • Mattias Sjögren

    #2
    Re: GAC - Context - Cache

    >Will this cache be long-lived and
    >
    >shared across all sharing applications?
    No, the assembly is loaded once per application, and you'll have one
    copy of the data per appdomain.

    >Also if I have some static constructors in some of the classes, when
    >will they be invoked -- do the normal rules apply here too that they
    >will be invoked only the first time any shared assembly tries to access
    >
    >them ?
    Yes. Again, once per loaded instance of the assembly.


    Mattias

    --
    Mattias Sjögren [C# MVP] mattias @ mvps.org
    http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
    Please reply only to the newsgroup.

    Comment

    • Prad

      #3
      Re: GAC - Context - Cache

      Mattias,
      I greatly appreciate your quick help on this!

      Just curious - so is there a way at all for a business component to
      cache date on the app server, to be visible by multiple app domains
      which would later load this component. (I mean a design pattern if any)

      Thanks again!


      Mattias Sjögren wrote:
      Will this cache be long-lived and

      shared across all sharing applications?
      >
      No, the assembly is loaded once per application, and you'll have one
      copy of the data per appdomain.
      >
      >
      Also if I have some static constructors in some of the classes, when
      will they be invoked -- do the normal rules apply here too that they
      will be invoked only the first time any shared assembly tries to access

      them ?
      >
      Yes. Again, once per loaded instance of the assembly.
      >
      >
      Mattias
      >
      --
      Mattias Sjögren [C# MVP] mattias @ mvps.org
      http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
      Please reply only to the newsgroup.

      Comment

      Working...