
Product
Introducing Socket MCP for Claude Desktop
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
= cache_flow
Drop-dead simple XML fragment caching in Builder templates!
How is it that RESTful web services riding Rails are such a big thing and there doesn't seem to be one definitive, up-to-date reference as to how to cache the XML output? Well cache_flow was built to solve that very problem... and surprisingly easily!
You may be saying to yourself, "Yes, Rails web services are cool, but only if you're using ActiveRecord::Base#to_xml." Agree to disagree. The to_xml approach is just fine, but it seems like scaffolding. I believe there are some serious advantages to building your XML in the view:
== Installation
In environment.rb:
Rails::Initializer.run do |config| config.gem 'cache_flow' end
At your application root, run:
$ sudo rake gems:install
== Example
To cache a chunk of XML, use the one method that cache_flow adds to your Builder instance, aptly named cache!:
xml.users, :type => 'array' do @users.each do |user| xml.cache!(user) do xml.user do xml.first_name user.first_name xml.last_name user.last_name end end end end
It's that easy! The cache! method takes the same arguments as the cache method we all know and love from our ERB views. So in the example above, user.cache_key will be automatically used as the cache key. You get all the same goodies as Rails' built-in fragment caching.
== How It Works
Behind the scenes, cache_flow is using the same mechanism that's used for caching ERB fragments, only using XmlMarkup#target! as its buffer rather than ActionView::Base#output_buffer. I'd like to take more credit, but it really is that simple.
== To-Do
FAQs
Unknown package
We found that cache_flow demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Add secure dependency scanning to Claude Desktop with Socket MCP, a one-click extension that keeps your coding conversations safe from malicious packages.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.