• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

caching variables?

Contributor ,
Apr 29, 2015 Apr 29, 2015

Copy link to clipboard

Copied

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?

Thanks!

Views

372

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , May 01, 2015 May 01, 2015

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.

Votes

Translate

Translate
Participant ,
May 01, 2015 May 01, 2015

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 04, 2015 May 04, 2015

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 02, 2015 May 02, 2015

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation