Module design with session based variable

Welcome Forums General PowerShell Q&A Module design with session based variable

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
1 year, 8 months ago.

  • Author
    Posts
  • #68173

    Participant
    Points: 1
    Rank: Member

    I have a few functions which call each other recursively. Some of these functions rely on an object in the session which provides caching functionality.

    With binary cmdlets, we have SessionState.PSVariable.{Set|GetValue} etc. With a text based module, what is the best approach?

  • #68175

    Keymaster
    Points: 1,704
    Helping HandTeam Member
    Rank: Community Hero

    A module-level variable.

  • #68196

    Participant
    Points: 324
    Helping Hand
    Rank: Contributor
  • #68211

    Participant
    Points: 1
    Rank: Member

    Thanks guys,
    So what does PrivateData (with all the limitations) actually provide over and above simple, non exported variables in the module file?

The topic ‘Module design with session based variable’ is closed to new replies.