2

我使用Dali gem为我的应用程序开发了低级(模型)缓存。

我通过修改打开了开发中的缓存environemnts/development.rb

#Show full error reports and disable caching
  config.consider_all_requests_local       = true
  #config.action_controller.perform_caching = false

#caching
  config.action_controller.perform_caching = true
  config.cache_store = :dalli_store

我的低级缓存效果很好,但现在页面需要几秒钟才能呈现:

Started GET "/locations/15" for 127.0.0.1 at 2013-09-20 08:30:08 -0500
Processing by LocationsController#show as HTML
Parameters: {"id"=>"15"}
 (1938.6ms)  SELECT * FROM geometry_columns WHERE f_table_name='locations'
Location Load (157.8ms)  SELECT "locations".* FROM "locations" WHERE "locations"."id" = $1 LIMIT 1  [["id", "15"]]
 (1.6ms)  SELECT * FROM geometry_columns WHERE f_table_name='users'
User Load (26.5ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
 (0.1ms)  BEGIN
 (0.1ms)  COMMIT
 (0.1ms)  BEGIN
 (0.4ms)  UPDATE "users" SET "last_sign_in_at" = '2013-09-19 14:18:08.387095', "current_sign_in_at" = '2013-09-20 13:30:11.455989', "sign_in_count" = 42, "updated_at" = '2013-09-20 13:30:11.457132' WHERE "users"."id" = 1
 (1.0ms)  COMMIT
 (1.6ms)  SELECT * FROM geometry_columns WHERE f_table_name='roles'
 (1.7ms)  SELECT * FROM geometry_columns WHERE f_table_name='users_roles'
 (44.2ms)  SELECT COUNT(*) FROM "roles" INNER JOIN "users_roles" ON "roles"."id" = "users_roles"."role_id" WHERE "users_roles"."user_id" = 1 AND (((roles.name = 'admin') AND (roles.resource_type IS NULL) AND (roles.resource_id IS NULL)))
Location Load (0.3ms)  SELECT "locations".* FROM "locations" WHERE "locations"."id" = $1 LIMIT 1  [["id", "15"]]
 (30.8ms)  SELECT * FROM geometry_columns WHERE f_table_name='zones'
Zone Load (60.8ms)  SELECT "zones".* FROM "zones" WHERE "zones"."location_id" = 15
 (24.8ms)  SELECT * FROM geometry_columns WHERE f_table_name='zone_geometries'
ZoneGeometry Load (15.1ms)  SELECT "zone_geometries".* FROM "zone_geometries" WHERE "zone_geometries"."zone_id" IN (450, 451, 457, 455, 456, 468, 463, 453, 470, 452, 454, 458, 459, 460, 461, 462, 464, 465, 466, 467, 469, 471, 472, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 489)
 (42.3ms)  SELECT * FROM geometry_columns WHERE f_table_name='geometries'
Geometry Load (65.9ms)  SELECT "geometries".* FROM "geometries" WHERE "geometries"."id" IN (314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 346, 342, 343, 344, 345, 366, 352, 353, 335, 336, 337, 338, 339, 368, 334, 340, 341, 347, 348, 349, 350, 351, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 367, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 385)
Rendered locations/show.html.haml within layouts/locations (31.1ms)

Compiled locations.js  (1072ms)  (pid 6750)
Compiled application.js  (152ms)  (pid 6750)
  Rendered layouts/_navigation.html.haml (8.8ms)
  Rendered layouts/_messages.html.haml (2.6ms)
Completed 200 OK in 9407ms (Views: 5669.7ms | ActiveRecord: 3018.3ms)
Cache read: http://localhost:3000/assets/jquery.ui.core.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.theme.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.menu.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.autocomplete.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.accordion.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.datepicker.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.button.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.resizable.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.dialog.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.progressbar.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.slider.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.selectable.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.spinner.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.tabs.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.tooltip.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.base.css?body=1
Cache read: http://localhost:3000/assets/jquery.ui.all.css?body=1
Cache read: http://localhost:3000/assets/open_layers/style.css?body=1
Cache read: http://localhost:3000/assets/jqplot.css?body=1
Cache read: http://localhost:3000/assets/pagination.css?body=1
Cache read: http://localhost:3000/assets/application.css?body=1
Cache read: http://localhost:3000/assets/a_maps_layout.css?body=1
Cache read: http://localhost:3000/assets/factory_details.css?body=1
Cache read: http://localhost:3000/assets/home.css?body=1
Cache read: http://localhost:3000/assets/workers.css?body=1
Cache read: http://localhost:3000/assets/bootstrap_and_overrides.css?body=1
Cache read: http://localhost:3000/assets/tags.css?body=1
Cache read: http://localhost:3000/assets/companies.css?body=1
Cache read: http://localhost:3000/assets/locations.css?body=1
Cache read: http://localhost:3000/assets/tracked_points.css?body=1
Cache read: http://localhost:3000/assets/jquery-ui-timepicker-addon.css?body=1
Cache read: http://localhost:3000/assets/alerts.css?body=1
Cache read: http://localhost:3000/assets/jquery.js?body=1
Cache read: http://localhost:3000/assets/jquery_ujs.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-transition.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-affix.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-alert.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-button.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-carousel.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-collapse.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-dropdown.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-modal.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-scrollspy.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-tab.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-tooltip.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-typeahead.js?body=1
Cache read: http://localhost:3000/assets/bootstrap.js?body=1
Cache read: http://localhost:3000/assets/openlayers/OpenLayers.js?body=1
Cache read: http://localhost:3000/assets/openlayers-rails.js?body=1
Cache read: http://localhost:3000/assets/bootstrap-popover.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.core.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.widget.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.accordion.js?body=1
Cache read: http://localhost:3000/assets/unity/UnityObject2.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.position.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.menu.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.autocomplete.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.button.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.datepicker.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.mouse.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.resizable.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.dialog.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.draggable.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.droppable.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-blind.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-clip.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-bounce.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-drop.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-explode.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-fade.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-fold.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-highlight.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-pulsate.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-scale.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-shake.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-slide.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.effect-transfer.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.progressbar.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.selectable.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.slider.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.sortable.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.spinner.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.tabs.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.tooltip.js?body=1
Cache read: http://localhost:3000/assets/jquery.ui.all.js?body=1
Cache read: http://localhost:3000/assets/jquery-ui-timepicker-addon.js?body=1
Cache read: http://localhost:3000/assets/jqplot/index.js?body=1
Cache read: http://localhost:3000/assets/jqplot/jquery.jqplot.js?body=1
Cache read: http://localhost:3000/assets/jqplot/excanvas.js?body=1
Cache read: http://localhost:3000/assets/jqplot/plugins/pieRenderer.js?body=1
Cache read: http://localhost:3000/assets/jqplot/plugins/barRenderer.js?body=1
Cache read: http://localhost:3000/assets/jqplot/plugins/categoryAxisRenderer.js?body=1
Cache read: http://localhost:3000/assets/jqplot/plugins/canvasAxisLabelRenderer.js?body=1
Cache read: http://localhost:3000/assets/jqplot/plugins/canvasTextRenderer.js?body=1
Cache read: http://localhost:3000/assets/companies.js?body=1
Cache read: http://localhost:3000/assets/alerts.js?body=1
Cache read: http://localhost:3000/assets/factories.js?body=1
Cache read: http://localhost:3000/assets/home.js?body=1
Cache read: http://localhost:3000/assets/hr_dept.js?body=1
Cache read: http://localhost:3000/assets/location_import.js?body=1
Cache read: http://localhost:3000/assets/locations.js?body=1
Cache write: e4ea0e53c7d1e141e39a45c019ddb9c80b6db6f3
Cache read: e4ea0e53c7d1e141e39a45c019ddb9c80b6db6f3
Cache read: http://localhost:3000/assets/locations.js?body=1
Cache write: http://localhost:3000/assets/locations.js?body=1
Cache read: http://localhost:3000/assets/tags.js?body=1
Cache read: http://localhost:3000/assets/tracked_points.js?body=1
Cache read: http://localhost:3000/assets/workers.js?body=1
Cache read: http://localhost:3000/assets/zones.js?body=1
Cache read: http://localhost:3000/assets/application.js?body=1
Cache write: db64b7bbc4b0bc22a81f6e07dbabfe5ce1fea54b
Cache read: db64b7bbc4b0bc22a81f6e07dbabfe5ce1fea54b
Cache read: http://localhost:3000/assets/application.js?body=1
Cache write: http://localhost:3000/assets/application.js?body=1
Cache read: http://localhost:3000/assets/private_pub.js?body=1
Cache read: http://localhost:3000/assets/zoom-in.png?
Cache read: http://localhost:3000/assets/zoom-out.png?
Cache read: http://localhost:3000/assets/pan.png?
Cache read: http://localhost:3000/assets/rotate.png?
Cache read: http://localhost:3000/assets/reset-view.png?
Cache read: http://localhost:3000/assets/view-2D.png?
Cache read: http://localhost:3000/assets/Tulsa_Driller.JPG?
Cache read: http://localhost:3000/assets/openlayers/theme/default/style.css?
Cache read: http://localhost:3000/assets/openlayers/img/layer-switcher-maximize.png?
Cache read: http://localhost:3000/assets/openlayers/img/layer-switcher-minimize.png?
Cache read: http://localhost:3000/locations/15/alerts?cache=1379683824151

它几乎看起来好像在每次访问之前都在预编译页面,这是在错误地尝试使用更高级别的缓存。在生产中,页面活泼而快速。

ActiveRecord 在此页面上运行需要 3 秒,但视图需要 6 秒?

Completed 200 OK in 9407ms (Views: 5669.7ms | ActiveRecord: 3018.3ms)

为了在开发中使用缓存而不杀死我的页面加载时间,我需要启用其他一些设置吗?

  • 导轨 3.2.13
  • 红宝石 1.9.3-p392
4

0 回答 0