Home > 技能|Skill > 极速提高WP的效率

极速提高WP的效率

June 23rd, 2010 74 comments /

WordPress的优化五花八门,方法层出不穷,但是优化之路永远都是没有最快、只有更快。

WordPress Object Cache 可以将一个耗时查询或者运算结果存储到一个缓存文件,这样就可以让我们不用老是重复到数据库中获取不变的数据,以缩短用户查看页面的速度。那么,我们如何开启它呢?

1、PHP 需要安装上 Memcached 扩展

是否安装了 Memcached 扩展请咨询服务器管理员。我所用的空间已经安装上了 Memcached 扩展,打开了缓存后自我感觉速度有明显提升。

2、编辑 wp-config.php 文件,在 WP_LANG 后面添加如下代码:

// Enable the WordPress Object Cache:
define('ENABLE_CACHE', 'true');

3、新建 /wp-content/cache 目录,设置权限 777。

4、下载 object-cache.php 文件并上传到wp-content 目录。下载地址

我在使用了该项优化后,首页数据库查询次数有所降低,不仅提高了 WordPress 的访问速度,同时还减低了数据库的负载,真是一举两得,快哉快哉!

Author: erick Categories: 技能|Skill Tags: , , ,
  1. June 25th, 2010 at 18:20 | #1

    你的代码插件是? :-|

  2. erick
    June 25th, 2010 at 19:04 | #2

    @Leyond: 不用使用插件

  3. 夏小君
    July 25th, 2010 at 00:29 | #3

    使用静态页也是提高访问速度的好办法了。 :twisted:

  4. September 5th, 2010 at 04:39 | #4

    学习了!

  5. September 26th, 2010 at 14:12 | #5

    减低数据库的负载,这个很好啊

  6. October 8th, 2010 at 18:31 | #6

    这个办法不错啊。近期在学习数据库呢。

  1. November 13th, 2011 at 08:57 | #1
  2. November 27th, 2011 at 22:58 | #2
  3. December 2nd, 2011 at 00:29 | #3
  4. December 2nd, 2011 at 04:28 | #4
  5. December 2nd, 2011 at 09:36 | #5
  6. December 2nd, 2011 at 14:31 | #6
  7. December 3rd, 2011 at 17:30 | #7
  8. December 3rd, 2011 at 22:49 | #8
  9. December 4th, 2011 at 13:46 | #9
  10. December 4th, 2011 at 14:59 | #10
  11. December 4th, 2011 at 19:18 | #11
  12. December 5th, 2011 at 00:48 | #12
  13. December 5th, 2011 at 20:07 | #13
  14. December 5th, 2011 at 21:59 | #14
  15. December 5th, 2011 at 23:32 | #15
  16. December 6th, 2011 at 03:55 | #16
  17. December 6th, 2011 at 16:44 | #17
  18. December 6th, 2011 at 20:43 | #18
  19. December 6th, 2011 at 23:33 | #19
  20. December 7th, 2011 at 04:59 | #20
  21. December 7th, 2011 at 13:43 | #21
  22. December 7th, 2011 at 15:26 | #22
  23. December 7th, 2011 at 16:07 | #23
  24. December 7th, 2011 at 22:13 | #24
  25. December 8th, 2011 at 06:39 | #25
  26. December 8th, 2011 at 10:51 | #26
  27. December 8th, 2011 at 12:38 | #27
  28. December 8th, 2011 at 18:36 | #28
  29. December 9th, 2011 at 01:11 | #29
  30. December 9th, 2011 at 03:14 | #30
  31. December 9th, 2011 at 13:29 | #31
  32. December 9th, 2011 at 20:39 | #32
  33. December 10th, 2011 at 07:20 | #33
  34. December 10th, 2011 at 15:56 | #34
  35. December 11th, 2011 at 04:24 | #35
  36. December 11th, 2011 at 07:07 | #36
  37. December 11th, 2011 at 21:55 | #37
  38. December 11th, 2011 at 22:35 | #38
  39. December 12th, 2011 at 02:41 | #39
  40. December 12th, 2011 at 05:06 | #40
  41. December 12th, 2011 at 12:07 | #41
  42. December 12th, 2011 at 18:30 | #42
  43. December 12th, 2011 at 20:24 | #43
  44. December 12th, 2011 at 23:38 | #44
  45. December 13th, 2011 at 03:59 | #45
  46. December 13th, 2011 at 04:15 | #46
  47. December 13th, 2011 at 18:32 | #47
  48. December 13th, 2011 at 21:28 | #48
  49. December 13th, 2011 at 23:40 | #49
  50. December 14th, 2011 at 02:23 | #50
  51. December 14th, 2011 at 05:17 | #51
  52. December 14th, 2011 at 19:41 | #52
  53. December 14th, 2011 at 23:53 | #53
  54. December 16th, 2011 at 10:58 | #54
  55. December 16th, 2011 at 17:36 | #55
  56. December 16th, 2011 at 18:19 | #56
  57. December 16th, 2011 at 21:32 | #57
  58. December 17th, 2011 at 05:27 | #58
  59. December 17th, 2011 at 06:07 | #59
  60. December 18th, 2011 at 03:31 | #60
  61. December 18th, 2011 at 20:35 | #61
  62. December 19th, 2011 at 00:40 | #62
  63. December 19th, 2011 at 19:53 | #63
  64. December 20th, 2011 at 03:18 | #64
  65. December 20th, 2011 at 07:08 | #65
  66. December 21st, 2011 at 05:53 | #66
  67. December 21st, 2011 at 13:53 | #67
  68. December 21st, 2011 at 18:22 | #68
  :?: :razz: :sad: :!: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: :smile: :evil: