I just want to know if it's possible to do caching (besides OS caching) without rearranging the code.

Sorry... I wouldn't know how to answer that without seeing some of the code in question. Actually, I'm not sure what that question means, if you are trying to ask about something other than loading all the file data into RAM.

Maybe BrowserUK has provided a relevant suggestion, if your existing code has "open()" statements scattered throughout that happen to be reopening the same files over and over. But if that is the case, perhaps going ahead with a suitable refactoring of the code would be time well spent.

(Updated to adjust grammar and punctuation, and to add the following:)

by query I do not mean sql query.

I wasn't specifically referring only to sql queries either, but was including an RDB solution as a possible alternative (along with hash look-up, which does not involve sql but could be viewed as another type of query). You've left it unclear what "query" means in your app, but perhaps that's not relevant.

My files are not in DB, I do not use DB at all.

And my point was: if your existing app is problematic in some way, you might want to consider using some sort of DB as an alternative for improving it.


In reply to Re^3: Caching files question by graff
in thread Caching files question by vit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.