mincore 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mincore.rb +12 -4
- metadata +3 -3
data/lib/mincore.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'inline'
|
2
2
|
|
3
|
-
|
3
|
+
# The File mincore extension
|
4
4
|
class File
|
5
5
|
|
6
|
-
|
7
|
-
inline do |builder|
|
8
|
-
|
6
|
+
# get pagesize (4096 on Intel)
|
7
|
+
inline do |builder|
|
9
8
|
builder.c_raw_singleton "
|
10
9
|
static VALUE PAGESIZE(int argc, VALUE *argv, VALUE self) {
|
11
10
|
int size = getpagesize();
|
@@ -146,6 +145,15 @@ static VALUE _cachedel(char *filename, int count) {
|
|
146
145
|
C_CODE
|
147
146
|
end
|
148
147
|
|
148
|
+
# Attempts to delete cached pages of a file, one or more times
|
149
|
+
#
|
150
|
+
# Example:
|
151
|
+
# >> File.cachedel("/path/to/useless/file", 2)
|
152
|
+
# => 0
|
153
|
+
#
|
154
|
+
# Arguments:
|
155
|
+
# filename: (String)
|
156
|
+
# count: (Int)
|
149
157
|
def self.cachedel(filename, count=1)
|
150
158
|
self._cachedel(filename, count)
|
151
159
|
end
|
metadata
CHANGED