Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin Lawrence 183 posts 350 karma points
    Apr 04, 2014 @ 11:39
    Kevin Lawrence
    0

    Accessing member properties (cached)

    Hi

    Every time I access member properties (vial getProperty("").Value) it results in a database call.

    Before I go ahead and cache the member myself is there a way to access the member properties in Umbraco without database calls?

    Thanks

    Kev

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Apr 04, 2014 @ 17:08
    Lee Kelleher
    0

    Hi Kevin,

    I believe that once you have got the 'member' object back, accessing the properties should be cached - or maybe at least only the first time you access a property it will hit the database and subsequent usage would be from the cache (as in the object itself).

    Hope this helps?

    Cheers,
    - Lee

  • Kevin Lawrence 183 posts 350 karma points
    Apr 04, 2014 @ 17:44
    Kevin Lawrence
    0

    Hi Lee

    I have a partial view that is accessing the properties, it is retrieving the member via:

     Member.GetCurrentMember()

    But each time I call the getProperty().Value the debug-trace is showing the same SQL fired with each request.

    Am I doing something wrong?

    Thanks

    Kev

  • Lee Kelleher 4020 posts 15802 karma points MVP 13x admin c-trib
    Apr 04, 2014 @ 17:54
    Lee Kelleher
    0

    Hi Kev,

    Which version of Umbraco are you using? In earlier versions (e.g. v4.x and earlier), it did do a direct database call per property, but I believe that was changed in v6+.

    It should initialise all the properties when GetCurrentMember is first called.

    Cheers,
    - Lee

  • Kevin Lawrence 183 posts 350 karma points
    Apr 04, 2014 @ 18:04
    Kevin Lawrence
    0

    Hi Lee

    It's v6.1.6.

    Kev

Please Sign in or register to post replies

Write your reply to:

Draft