You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Litestack is a Ruby gem that provides both Ruby and Ruby on Rails applications an all-in-one solution for web application data infrastructure. It exploits the power and embeddedness of SQLite to deliver a full-fledged SQL database, a fast cache , a robust job queue, a reliable message broker, a full text search engine and a metrics platform all in a single package.
@@ -105,37 +107,37 @@ In your desired environment file (e.g. production.rb)
This provides a transparent integration that uses the Rails caching interface
110
+
This provides a transparent integration that uses the Rails caching interface
109
111
110
112
litecache spawns a background thread for cleanup purposes. In case it detects that the current environment has *Fiber::Scheduler* or *Polyphony* loaded it will spawn a fiber instead, saving on both memory and CPU cycles.
More info about Litejob can be found in the [litejob guide](https://github.com/oldmoe/litestack/wiki/Litejob-guide)
115
117
116
-
litejob is a fast and very efficient job queue processor for Ruby applications. It builds on top of SQLite as well, which provides transactional guarantees, persistence and exceptional performance.
118
+
litejob is a fast and very efficient job queue processor for Ruby applications. It builds on top of SQLite as well, which provides transactional guarantees, persistence and exceptional performance.
117
119
118
120
#### Direct litejob usage
119
121
```ruby
120
122
require'litestack'
121
123
# define your job class
122
124
classMyJob
123
125
include ::Litejob
124
-
126
+
125
127
queue =:default
126
-
128
+
127
129
# must implement perform, with any number of params
128
130
defperform(params)
129
131
# do stuff
130
132
end
131
133
end
132
-
134
+
133
135
#schedule a job asynchronusly
134
136
MyJob.perform_async(params)
135
-
137
+
136
138
#schedule a job at a certain time
137
139
MyJob.perform_at(time, params)
138
-
140
+
139
141
#schedule a job after a certain delay
140
142
MyJob.perform_after(delay, params)
141
143
```
@@ -202,7 +204,7 @@ idx.add({sender: 'Kamal', receiver: 'Laila', subject: 'Are the girls awake?', bo
202
204
# search the index, all fields
203
205
idx.search('kamal')
204
206
# search the index, specific field, partial workd (trigram)
205
-
idx.search('subject: awa')
207
+
idx.search('subject: awa')
206
208
```
207
209
208
210
Litesearch integrates tightly with ActiveRecord ans Sequel, here are integration examples
@@ -226,8 +228,8 @@ class Book < ActiveRecord::Base
226
228
end
227
229
end
228
230
# insert records
229
-
Author.create(name: 'Adam A. Writer')
230
-
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
231
+
Author.create(name: 'Adam A. Writer')
232
+
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
231
233
# search the index, the search method integrates with AR's query interface
232
234
Book.search('author: writer').limit(1).all
233
235
```
@@ -249,8 +251,8 @@ class Book < Sequel::Model
249
251
end
250
252
end
251
253
# insert records
252
-
Author.create(name: 'Adam A. Writer')
253
-
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
254
+
Author.create(name: 'Adam A. Writer')
255
+
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
254
256
# search the index, the search method integrates with Sequel's query interface
0 commit comments