Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 468867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:43:30+00:00 2026-05-12T23:43:30+00:00

I have a caching system build within php that stores the results of a

  • 0

I have a caching system build within php that stores the results of a mysql query in xml. I lock the cache when building by creating a lock file with an exclusive write handle, and then remove it once the cache file is completed.

However, there are times when the script either times out or halts mid execution, leaving the lock file in place, making any further executions of the script think that the cache is always updating.

I have tried checking for the file being a number of minutes old and attempting to get an exclusive write access to the file to refresh the lock and begin execution, however it appears that the file is still open with the previous handle and I cannot open the new handle to ensure the current process is the only one with access and relock the file.

Is there a way to ensure that if the script is halted mid execution, any open file handles get closed and the files involved are available for future processes to access?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:43:30+00:00Added an answer on May 12, 2026 at 11:43 pm

    When the PHP interpreter exits it calls fclose() on all open files, thus releasing any locks. Maybe you haven’t found the right problem yet.

    However, when you need to clean up something before the script terminates – use register_shutdown_function(). The registered function will be called even when the script terminates with an error.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp.net web forms app that uses System.Web.Caching.Cache to cache xml data
I have a file caching system for a php application. if a file needs
In Yii, I have enabled APC caching through the config/main.php file: 'cache' => array(
I have been researching and have some few ideas about a distributed caching system
I have a website that allows users to query for specific recipes using various
Does Google Maps V3 API have any form of built in caching system for
I am currently writing a caching system that will hold serialized (json) data on
I am looking for a DB Caching System with which I can Cache my
I have been creating a php application that makes quite a few queries to
I am going to build a site that have dynamic content (properties as title,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.