<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating a cache file in php for API requests</title>
	<atom:link href="http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/feed" rel="self" type="application/rss+xml" />
	<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html</link>
	<description>PHP Tutorials collection</description>
	<lastBuildDate>Wed, 21 Jul 2010 10:31:54 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: inversechi</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-222</link>
		<dc:creator>inversechi</dc:creator>
		<pubDate>Wed, 03 Mar 2010 06:14:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-222</guid>
		<description>This helped me getting started with writing a simple caching plugin for API&#039;s to use within codeigniter - thank you :)</description>
		<content:encoded><![CDATA[<p>This helped me getting started with writing a simple caching plugin for API&#39;s to use within codeigniter &#8211; thank you <img src='http://phpcollection.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Php Ninza</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-223</link>
		<dc:creator>Php Ninza</dc:creator>
		<pubDate>Wed, 03 Mar 2010 04:32:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-223</guid>
		<description>@inversechi

Sounds great, It would also help if you can share the link of that plugin. I myself have moved to CI and would love to use that plugin.</description>
		<content:encoded><![CDATA[<p>@inversechi</p>
<p>Sounds great, It would also help if you can share the link of that plugin. I myself have moved to CI and would love to use that plugin.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Php Ninza</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-221</link>
		<dc:creator>Php Ninza</dc:creator>
		<pubDate>Tue, 22 Dec 2009 11:41:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-221</guid>
		<description>My pleasure @Lucas</description>
		<content:encoded><![CDATA[<p>My pleasure @Lucas</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucas</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-220</link>
		<dc:creator>Lucas</dc:creator>
		<pubDate>Sun, 22 Nov 2009 00:00:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-220</guid>
		<description>Nice tutorial. Thanks!!</description>
		<content:encoded><![CDATA[<p>Nice tutorial. Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Php Ninza</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-219</link>
		<dc:creator>Php Ninza</dc:creator>
		<pubDate>Mon, 24 Aug 2009 16:17:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-219</guid>
		<description>@h4cc

Thanks for clarifying !, Appreciated that !</description>
		<content:encoded><![CDATA[<p>@h4cc</p>
<p>Thanks for clarifying !, Appreciated that !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: h4cc</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-218</link>
		<dc:creator>h4cc</dc:creator>
		<pubDate>Mon, 24 Aug 2009 15:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-218</guid>
		<description>A few comments to my rewrite.
The old function used 2 files to save the data. 1 file that kept the data, the other file was just there to keep the last changed timestamp.
This way it has several disadvantaged.
- Using 2 files is slower and needs more space.
- Using a timestamp file could be if problem if another program changed the cache file without changing timestamp file.
- The timestamp of the last change action on a file is stored within the filsesystem itself. This value can be accessed very quickly and is also very reliable.

There were also some security holes in this function. Reading and writing files should be controlled strictly. It is possible to read/write a file if you include &#039;../&#039; to go to the upper directory and use a nullbyte at the end to select a other file then specified.

Plus Bug was fixed. If the get_yahoo_data() could not fetch the data and would return not the current XML, this wrong XML would by cached.</description>
		<content:encoded><![CDATA[<p>A few comments to my rewrite.<br />
The old function used 2 files to save the data. 1 file that kept the data, the other file was just there to keep the last changed timestamp.<br />
This way it has several disadvantaged.<br />
- Using 2 files is slower and needs more space.<br />
- Using a timestamp file could be if problem if another program changed the cache file without changing timestamp file.<br />
- The timestamp of the last change action on a file is stored within the filsesystem itself. This value can be accessed very quickly and is also very reliable.</p>
<p>There were also some security holes in this function. Reading and writing files should be controlled strictly. It is possible to read/write a file if you include &#8216;../&#8217; to go to the upper directory and use a nullbyte at the end to select a other file then specified.</p>
<p>Plus Bug was fixed. If the get_yahoo_data() could not fetch the data and would return not the current XML, this wrong XML would by cached.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phpcollection</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-217</link>
		<dc:creator>phpcollection</dc:creator>
		<pubDate>Mon, 24 Aug 2009 07:56:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-217</guid>
		<description>&lt;p&gt;@h4cc Rewrote the post !,  &lt;a href=&quot;http://bit.ly/r9RbO&quot; rel=&quot;nofollow&quot;&gt;http://bit.ly/r9RbO&lt;/a&gt; With your reference and the modified function !, Please let me know if u are nt ok with that!&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/phpcollection/statuses/3508867396&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>@h4cc Rewrote the post !,  <a href="http://bit.ly/r9RbO" rel="nofollow">http://bit.ly/r9RbO</a> With your reference and the modified function !, Please let me know if u are nt ok with that!</p>
<p><i>This comment was originally posted on <a href="http://twitter.com/phpcollection/statuses/3508867396" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: phpprofessional</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-216</link>
		<dc:creator>phpprofessional</dc:creator>
		<pubDate>Mon, 24 Aug 2009 02:41:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-216</guid>
		<description>&lt;p&gt;Create cache file for REST apis in PHP &#124; PHP tutorials and Scripts Collection &lt;a href=&quot;http://bit.ly/MjfPd&quot; rel=&quot;nofollow&quot;&gt;http://bit.ly/MjfPd&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;This comment was originally posted on &lt;a href=&quot;http://twitter.com/phpprofessional/statuses/3504548651&quot; rel=&quot;nofollow&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Create cache file for REST apis in PHP | PHP tutorials and Scripts Collection <a href="http://bit.ly/MjfPd" rel="nofollow">http://bit.ly/MjfPd</a></p>
<p><i>This comment was originally posted on <a href="http://twitter.com/phpprofessional/statuses/3504548651" rel="nofollow">Twitter</a></i></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Php Ninza</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-215</link>
		<dc:creator>Php Ninza</dc:creator>
		<pubDate>Sun, 23 Aug 2009 04:42:51 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-215</guid>
		<description>@Mardix

That&#039;s a very valuable peace of advice , Surely it will help a lot of people.

However ,Saving cache in database has some future problems , One of the main problem is that at a point sql queries hurt as these heavy sql queries make server very slow.

Hope it helps</description>
		<content:encoded><![CDATA[<p>@Mardix</p>
<p>That&#8217;s a very valuable peace of advice , Surely it will help a lot of people.</p>
<p>However ,Saving cache in database has some future problems , One of the main problem is that at a point sql queries hurt as these heavy sql queries make server very slow.</p>
<p>Hope it helps</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mardix</title>
		<link>http://phpcollection.com/creating-a-cache-file-in-php-for-api-requests.html/comment-page-1#comment-214</link>
		<dc:creator>Mardix</dc:creator>
		<pubDate>Sun, 23 Aug 2009 01:34:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.phpcollection.com/?p=702#comment-214</guid>
		<description>Surprisingly, yesterday I wrote something like that to cache results from: Twitter,Youtube and Flickr api in a database.

-- This is what I did --

Before saving the results, I SERIALIZE the data, set an expire time and save it in the db.
To retrieve it, the script then check the expired time, if time has not expired yet, it will just get the serialized data to UNSERIALIZE it and return it as it&#039;s native state. Otherwise it will access the api again, serialize it, set new expired time and save it.

I hope this help someone.

:)</description>
		<content:encoded><![CDATA[<p>Surprisingly, yesterday I wrote something like that to cache results from: Twitter,Youtube and Flickr api in a database.</p>
<p>&#8211; This is what I did &#8211;</p>
<p>Before saving the results, I SERIALIZE the data, set an expire time and save it in the db.<br />
To retrieve it, the script then check the expired time, if time has not expired yet, it will just get the serialized data to UNSERIALIZE it and return it as it&#8217;s native state. Otherwise it will access the api again, serialize it, set new expired time and save it.</p>
<p>I hope this help someone.<br />
 <img src='http://phpcollection.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
