3 Replies Latest reply on May 4, 2015 3:51 AM by BreakawayPaul

    caching variables?

    BreakawayPaul Level 2

      I've been on a mission to optimize things in our web template, and I've been using a lot of query caching with fantastic results.


      One place I think can be improved is variable assignment.  We assign several variables that use CGI.SCRIPT_NAME, and I'm not sure how resource intensive that is.  I'm wondering if I can use cfcache to server-cache these variables to keep them from having to be set on each page request, but the documentation on that tag isn't great.


      Does anyone here have any insight or guidance?



        • 1. Re: caching variables?
          CutterBl Level 1

          CGI.SCRIPT_NAME is a request level item. This is a variable returned by your web server that gives the path of the page being requested, so caching this would not be a good idea.


          I have a multi-part series on my blog on updating legacy applications, with a succession of posts that talk about scope assignments that may be beneficial to your refactoring.

          • 2. Re: caching variables?
            BKBK Adobe Community Professional & MVP

            It makes sense to cache CPU-intensive resources, for example, the result of a query, of an HTTP call or of a complex evaluation. You will get no benefit by caching CGI.SCRIPT_NAME. It is basically a constant, whose evaluation costs negligible CPU resources.

            • 3. Re: caching variables?
              BreakawayPaul Level 2

              Cool! Thanks everyone.


              The main reason I asked about this is because we have a lot of pages that seem to lag for no good reason (and we also have unexplained random server crashes), and upon inspection of some of these pages (written by people who are now long-gone), I've found things like multiple, redundant expandpath() functions, and recoding these pages has helped a lot (with the speed, not the server crashes).


              So I'm looking for improvements wherever I can get them.