欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ruby面试系列四,新鲜刚出炉的面试题 博客分类: RubyOnRails cacheactiverecordrails 

程序员文章站 2024-03-19 19:57:16
...
这次是留的家庭作业

引用

Write a model (ActiveRecord-based, or similar pattern) for storing
configuration settings.

Each setting should have a unique identifier such as a name, and
should hold a single value. For example: an email address used to send
error emails, or a boolean flag to enable/disable a particular
feature. It must be possible to store values of at least these 4
types: string, integer, float and boolean.

The purpose of this exercise is to show your code design skills.
Therefore, the model's interface for reading and writing configuration
values must be simple and convenient. It should be possible to read
and write specific values, versus reading and writing all the
configuration settings all at once. The model should come with unit
tests and database migrations, or whatever is required given your
persistent storage setup.

Bonus: add caching so that values don't need to be read from the
database every time they are accessed. If using Ruby on Rails,
consider  using standard Rails caching techniques for this. HTML
caching should not be required.


这个个加分的缓存是说啥呢