dongyong6045 2014-05-31 12:05
浏览 18
已采纳

巨大的PHP文件脚本[关闭]

I have PHP script (machine generated), that has size of 3MB. Its content is mainly couple of switches and echo. It is not doint anything, only echos. I am using it as "cache" for slow SQL queries, so I generate all possible outputs to this PHP and then use ID in URL to get appropriate result.

So far I have been using script that has 700KB and all was OK. Now, I added some data and I ended up with 3MB. Is it OK to run this or should I consider some other solution ?

  • 写回答

2条回答 默认 最新

  • douguabu8960 2014-05-31 12:31
    关注

    It sounds like you're rolling your own wonky wheel. Consider using a widely accepted caching solution like APC or memcache.

    Also consider using the Zend caching component which can be extracted and used in isolation from the rest of the framework and provides an abstracted API for many caching back ends including file based, APC and memcache.

    The solution you've described will probably use excessive memory for every execution, waste CPU parsing unnecessary PHP code and make it difficult to handle things like invalidations.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 iqoo11 如何下载安装工程模式
  • ¥15 本题的答案是不是有问题
  • ¥15 关于#r语言#的问题:(svydesign)为什么在一个大的数据集中抽取了一个小数据集
  • ¥15 C++使用Gunplot
  • ¥15 这个电路是如何实现路灯控制器的,原理是什么,怎么求解灯亮起后熄灭的时间如图?
  • ¥15 matlab数字图像处理频率域滤波
  • ¥15 在abaqus做了二维正交切削模型,给刀具添加了超声振动条件后输出切削力为什么比普通切削增大这么多
  • ¥15 ELGamal和paillier计算效率谁快?
  • ¥15 蓝桥杯单片机第十三届第一场,整点继电器吸合,5s后断开出现了问题
  • ¥15 file converter 转换格式失败 报错 Error marking filters as finished,如何解决?