Jump to content

Loading XML into memory, possible? Worth it?


deanlearner

Recommended Posts

Hi everyone,

 

I have made a system that uses XML as a basis for directory permissions

<?xml version="1.0" encoding="ISO-8859-1"?>
<permissions group_a="1" group_b="1">
  <folder1 group_b="0" />
  <folder2>
    <page1.php group_a="0" />
    <page2.php group_b="0" />
  </folder2>
</permissions>

Basically, the system looks for the most relevant permission possible, so if a user of group_a requests /folder2/page1.php access will be denied because access is set to "0". If a user of group_b requests /folder2/page1.php access will be granted because the most relevant permission is set in the head xml tag.

 

This file will be accessed via the system with every request made by a user so I am wondering if it's worth it, or possible to store it in memory? I know multiple files will be accessed with every request, but as I know this one will always occur I am wondering about loading it into memory.

 

Also, while hoping people are actually able to understand the security scheme I've used above, would anyone suggest an alternative? Would storing permissions for each possible request URI (ignoring $_GET stuff) in a database be a better solution?

 

There will be about 20-30 users of this system at any one time (so again, maybe I am threating about something thats not important at all).

 

Thanks again.

Link to comment
Share on other sites

I am wondering if it's worth it ... to store it in memory?

 

Most likely, not. Until you run proper profiling on the system, to discover and analyse weak points, it is usually not worth worrying about "small" things (of which this is one).  If at some point the loading and parsing of this file becomes troublesome, you will (or should have in place the resources to) know it and the answer would be obvious.

 

Of course, there are various ways to get that data loaded cross-request in a less memory/time/etc. way which you might like to discuss here regardless of whether it is really necessary at this stage, if you really want to?

Link to comment
Share on other sites

Thanks for the reply Salathe, based on the fact you think this is a small issue, I'll stick with my current system for now but might post again regarding finding an alternative solution at a later date, but hopefully it won't come need to come to that!

 

Thanks again

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.