Copied to clipboard

Flag this post as spam?

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


  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 26, 2018 @ 14:43
    Lee Kelleher
    0

    Using RelationService on the frontend?

    Is anyone using the RelationService API on the frontend of their website?

    With all the Umbraco Service APIs being for database (CRUD) operations, I'd like to avoid any performance bottlenecks on the frontend.

    When I've used RelationService previously, I've ended up writing my own quick-n-dirty caching layer ... but I wonder what others are doing - and if there's a better approach?

    Thanks,
    - Lee

  • Tim 1193 posts 2655 karma points c-trib
    Mar 26, 2018 @ 15:08
    Tim
    1

    In the cases where I've done this, I've pretty much done what you have and implemented my own quick and dirty caching!

  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Mar 26, 2018 @ 18:07
    Dave Woestenborghs
    1

    Quick and dirty caching layer. If you are running a loadbalanced server make sure that your cache get's refreshed on all servers. You can implement a ICacheRefresher for that

    Dave

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 27, 2018 @ 08:20
    Lee Kelleher
    0

    Thanks Tim and Dave ... looks like I'll be sticking with my quick-n-dirty caching! :-P

    Good point about the ICacheRefresher too!

    Thanks,
    - Lee

  • Damiaan 438 posts 1290 karma points MVP 3x c-trib
    Mar 27, 2018 @ 12:37
    Damiaan
    1

    We inherited a few websites with "dirty" caching layers. I like quick, i don't like dirty. :-)

    If you use the built-in Umbraco Caching which repopulates if the cache expires, you'll be good to go.

    var id = 123;
    var valueFromCache = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem("cackeykey-123", () =>
    {
        var myRelation= ApplicationContext.Services.RelationService.GetByParentOrChildId(id);
        return myRelation;
    });
    
  • Dave Woestenborghs 3325 posts 11170 karma points MVP 5x admin c-trib
    Mar 27, 2018 @ 14:17
    Dave Woestenborghs
    0

    LOL. when is said quick and dirty I actually used this way :-)

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Mar 28, 2018 @ 08:23
    Lee Kelleher
    0

    Yup, same I stick with using ApplicationCache too! 👍

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies