Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 193
- Log:
First stage commit of Typo 4.1, modified for the ROOL site.
Includes all local modifications but a final pass needs to be
made to delete any files left over from earlier Typo versions
that shouldn't be here anymore. See the 'tags' section of the
repository for a clean Typo 4.1 tree.Note that symlinks to shared files in the RISC OS Open theme
directory have been deliberately included this time around; I
decided that on balance it was better to leave them in as
placeholders, since unlike symlinks in app/views/shared, the
Typo theme structure is not a standard Rails concept.
- Author:
- rool
- Date:
- Wed Apr 04 18:51:02 +0100 2007
- Size:
- 2214 Bytes
1 | ## |
2 | # A utility wrapper around the MemCache client to simplify cache access. All |
3 | # methods silently ignore MemCache errors. |
4 | |
5 | module Cache |
6 | |
7 | ## |
8 | # Returns the object at +key+ from the cache if successful, or nil if |
9 | # either the object is not in the cache or if there was an error |
10 | # attermpting to access the cache. |
11 | # |
12 | # If there is a cache miss and a block is given the result of the block |
13 | # will be stored in the cache with optional +expiry+. |
14 | |
15 | def self.get(key, expiry = 0) |
16 | start_time = Time.now |
17 | result = CACHE.get key |
18 | end_time = Time.now |
19 | ActiveRecord::Base.logger.debug('MemCache Get (%0.6f) %s' % |
20 | [end_time - start_time, key]) |
21 | return result |
22 | rescue MemCache::MemCacheError => err |
23 | ActiveRecord::Base.logger.debug "MemCache Error: #{err.message}" |
24 | if block_given? then |
25 | value = yield |
26 | put key, value, expiry |
27 | return value |
28 | else |
29 | return nil |
30 | end |
31 | end |
32 | |
33 | ## |
34 | # Places +value+ in the cache at +key+, with an optional +expiry+ time in |
35 | # seconds. |
36 | |
37 | def self.put(key, value, expiry = 0) |
38 | start_time = Time.now |
39 | CACHE.set key, value, expiry |
40 | end_time = Time.now |
41 | ActiveRecord::Base.logger.debug('MemCache Set (%0.6f) %s' % |
42 | [end_time - start_time, key]) |
43 | rescue MemCache::MemCacheError => err |
44 | ActiveRecord::Base.logger.debug "MemCache Error: #{err.message}" |
45 | end |
46 | |
47 | ## |
48 | # Deletes +key+ from the cache in +delay+ seconds. (?) |
49 | |
50 | def self.delete(key, delay = nil) |
51 | start_time = Time.now |
52 | CACHE.delete key, delay |
53 | end_time = Time.now |
54 | ActiveRecord::Base.logger.debug('MemCache Delete (%0.6f) %s' % |
55 | [end_time - start_time, key]) |
56 | rescue MemCache::MemCacheError => err |
57 | ActiveRecord::Base.logger.debug "MemCache Error: #{err.message}" |
58 | end |
59 | |
60 | ## |
61 | # Resets all connections to mecache servers. |
62 | |
63 | def self.reset |
64 | CACHE.reset |
65 | ActiveRecord::Base.logger.debug 'MemCache Connections Reset' |
66 | end |
67 | |
68 | end |
69 | |
70 | # vim: ts=4 sts=4 sw=4 |
71 |