Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. Pro Cache Usage

Pro Cache Usage

Scheduled Pinned Locked Moved The Weird and The Wonderful
com
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member 4162784
    wrote on last edited by
    #1

    good practices to use a memcached client to make your site faster!

    public IEnumerable<Product> GetProductList()
    {
    List<Product> data = null;
    var key = string.Format("{0}", "Some_Beautiful_Key");
    if (_cache != null)
    if (_cache.Contains(key))
    data = _cache.Get< List >(key);
    data = TheDao.GetProductTable();
    if (_cache != null)
    _cache.SaveOrUpdate(key, data);

    return data;
    

    }

    Rudy Alvarez // rdebug.com

    R B 2 Replies Last reply
    0
    • M Member 4162784

      good practices to use a memcached client to make your site faster!

      public IEnumerable<Product> GetProductList()
      {
      List<Product> data = null;
      var key = string.Format("{0}", "Some_Beautiful_Key");
      if (_cache != null)
      if (_cache.Contains(key))
      data = _cache.Get< List >(key);
      data = TheDao.GetProductTable();
      if (_cache != null)
      _cache.SaveOrUpdate(key, data);

      return data;
      

      }

      Rudy Alvarez // rdebug.com

      R Offline
      R Offline
      RobCroll
      wrote on last edited by
      #2

      Cache smash. Who needs it anyway?

      "You get that on the big jobs."

      1 Reply Last reply
      0
      • M Member 4162784

        good practices to use a memcached client to make your site faster!

        public IEnumerable<Product> GetProductList()
        {
        List<Product> data = null;
        var key = string.Format("{0}", "Some_Beautiful_Key");
        if (_cache != null)
        if (_cache.Contains(key))
        data = _cache.Get< List >(key);
        data = TheDao.GetProductTable();
        if (_cache != null)
        _cache.SaveOrUpdate(key, data);

        return data;
        

        }

        Rudy Alvarez // rdebug.com

        B Offline
        B Offline
        Bernhard Hiller
        wrote on last edited by
        #3

        When you already omit the {curly brackets}, you should not hesitate and do the next step: omit indentation, or better use random indentation.

        public IEnumerable<Product> GetProductList()
        {
        List<Product> data = null;
        var key = string.Format("{0}", "Some_Beautiful_Key");
        if (_cache != null)
        if (_cache.Contains(key)) data = _cache.Get<List<Product>>(key);
        data = TheDao.GetProductTable();
        if (_cache != null) _cache.SaveOrUpdate(key, data);
        return data;
        }

        And such features will be even harder to spot for the guys who have to fix your code.

        B M 2 Replies Last reply
        0
        • B Bernhard Hiller

          When you already omit the {curly brackets}, you should not hesitate and do the next step: omit indentation, or better use random indentation.

          public IEnumerable<Product> GetProductList()
          {
          List<Product> data = null;
          var key = string.Format("{0}", "Some_Beautiful_Key");
          if (_cache != null)
          if (_cache.Contains(key)) data = _cache.Get<List<Product>>(key);
          data = TheDao.GetProductTable();
          if (_cache != null) _cache.SaveOrUpdate(key, data);
          return data;
          }

          And such features will be even harder to spot for the guys who have to fix your code.

          B Offline
          B Offline
          BobJanova
          wrote on last edited by
          #4

          Eww ... *shivers*

          1 Reply Last reply
          0
          • B Bernhard Hiller

            When you already omit the {curly brackets}, you should not hesitate and do the next step: omit indentation, or better use random indentation.

            public IEnumerable<Product> GetProductList()
            {
            List<Product> data = null;
            var key = string.Format("{0}", "Some_Beautiful_Key");
            if (_cache != null)
            if (_cache.Contains(key)) data = _cache.Get<List<Product>>(key);
            data = TheDao.GetProductTable();
            if (_cache != null) _cache.SaveOrUpdate(key, data);
            return data;
            }

            And such features will be even harder to spot for the guys who have to fix your code.

            M Offline
            M Offline
            Member 4162784
            wrote on last edited by
            #5

            I'm the guy that fix code :'( jajajaja

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups