Announcement Announcement Module
No announcement yet.
ColdFusion: Do Contexts persist in memory and is there a way to load them if they do? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ColdFusion: Do Contexts persist in memory and is there a way to load them if they do?

    Spring newbie here. I got thrown into a project where I need to have ColdFusion use spring. ColdFusion - like PHP or any other web language - is going to run the "program" each time someone hits a page.

    I was informed that this is very slow and inefficient and that perhaps I should do some sort of context caching.

    The best way to think of the problem is this: I have a unique identifier (in this case, I'll probably just use the template path to the .cfm page). If no context for it exists, initialize one. If it does exist, load and use the cached one.

    Here's the problem: How do I cache a context? Do they persist in memory? If they do, how do I access them?

    Is there possibly another way to handle this?

    Thanks in advance!

  • #2
    You should not create and cache multiple context instance. Consider using web-specific bean scopes. I.e. you create context only once and create short-living request- or session-bounded beans as necessary during client requests processing.


    • #3
      We will actually have a bunch of different applications running in the same ColdFusion "container" (cluster), and each application will need its own Spring Context.

      There could multiple people using the same app, but that app should only create the context once and then reuse it on subsequent requests by one or more people.

      All the Spring stuff is written in a Java customtag, which is called by ColdFusion. It's kind of a tree hierarchy. The users are the leaves, their parents are the applications, and the root is the Java customtag that should associate each app with only one context.

      I hope I'm making sense. Let me know if I'm not. :-)


      • #4
        Ok, so you can create necessary context and reuse them for subsequent calls. Just save the reference to the context object in order to make it ineligible for garbage collection and that's all.