sb3108sa / phpbrowscap

Automatically exported from code.google.com/p/phpbrowscap
GNU Lesser General Public License v2.1
0 stars 0 forks source link

Rewrite to include XCache in-memory cache support & auto update based on file version #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi Jonathan,

Thanks for starting this project! I recently needed browser parsing ability
in some PHP code I was writing. Your file gave me a great place to start.

I have made extensive changes to Browscap.php with the main purpose of
supporting the in-memory cache provided by XCache. XCache is a PHP opcode
cacher similar to APC (http://xcache.lighttpd.net). With the changes I have
made, it should be relatively trivial to add additional in-memory cache
types. (APC, memcached, etc...)

I have also completed the versioning work started by Austin Bischoff. The
auto update feature now uses browscap.ini version numbers instead of file
modification times.

To accomodate storing the various object properties in XCache, I have
changed the format of the cache.php file. Instead of writing out php code
in _buildCache() and using require() in _loadCache(), I now use PHP's
serialize() and unserialize() functions. This allows the same format to be
used for both file and in-memory cache types, and simplifies the code.

I have added some other small enhancements as appropriate. I have also
rearranged the functions in the file, so they appear in the order they are
called in the code. It was just easier for me to work on that way.
Unfortunately, with all the changes, a diff file was not possible. So, I am
attaching the fully re-written Browscap.php. I have tested everything and
it all seems to work well. The in-memory cache is visibly faster than the
file cache.

Let me know what you think.

Thanks,
--jeff

Original issue reported on code.google.com by jeff.kil...@gmail.com on 2 Mar 2009 at 3:22

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Jonathan,

I'm continuing to revise this. Here is a patch with my latest changes. This 
patch
prevents the cache from being reloaded immediately after browscap.ini is parsed,
which would be redundant.

I am using this version in my development and probably won't make any further
revisions until I hear back from you.

Thanks,
--jeff

Original comment by jeff.kil...@gmail.com on 3 Mar 2009 at 3:29

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Jeff,
I took a look at your implementation and I think it's worth a branch in the 
repository. I can add you as a project 
member and then you can commit yourself the changes you do.

I think it's better we continue this discussion via email ;-)

Original comment by st.jonat...@gmail.com on 3 Mar 2009 at 7:21