{"id":22535724,"url":"https://github.com/ik5/redis_session","last_synced_at":"2025-04-09T19:09:06.160Z","repository":{"id":3486012,"uuid":"4541750","full_name":"ik5/redis_session","owner":"ik5","description":"A session based class using Redis","archived":false,"fork":false,"pushed_at":"2021-05-25T17:27:06.000Z","size":93,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T21:02:43.418Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ik5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-04T00:17:54.000Z","updated_at":"2023-03-22T19:14:27.000Z","dependencies_parsed_at":"2022-08-28T09:21:40.489Z","dependency_job_id":null,"html_url":"https://github.com/ik5/redis_session","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ik5%2Fredis_session","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ik5%2Fredis_session/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ik5%2Fredis_session/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ik5%2Fredis_session/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ik5","download_url":"https://codeload.github.com/ik5/redis_session/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247725936,"owners_count":20985796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T10:08:22.542Z","updated_at":"2025-04-09T19:09:06.139Z","avatar_url":"https://github.com/ik5.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Redis Session \n\nRedis\\_session is a ruby based library that allow every ruby application to \nstore information using Redis.\n\nThe design of the library was for disconnected non web based applications, but\nit can be used for web based applications just as well.\n\nBy providing unique prefix for each session, you can distinguish between each \nrequest.\n\n## Current features\n\n * Adding prefix to each session instance\n * Expiring keys globally or specific keys\n * Saving keys with values, and possible to add expire time in seconds\n * Set expire time to existing keys (updating time for already expiring keys)\n * Restoring values, and giving default values (by default if no value, \n   it returns an empty hash)\n * Checking the remaining time of keys\n * Checking if key exists\n * Checking if key has a value\n * Removing keys\n * Changing the prefix using the prefix= method\n * find key and value based on custom lookup\n\n### Documentation\n\n The source code is using rdoc.\n\nExample:\n--------\n    require 'redis_session'\n\n    session = Session::SessionClient.new(:prefix =\u003e 'example')\n\n    session.save('key', 'value') # save key with the value of value \n                                 # without expire, return true if successful\n    puts session.restore('key')  # will return \"value\"\n\n    session.save('self_destruct', 'in', 10) # save the key self_destruct with \n                                            # the value of 'in', and will \n                                            # terminates in 10 seconds\n    sleep 10.1\n    session.restore('self_destruct')      # returns empty hash\n    session.restore('self_destruct', nil) # returns default value of nil\n\n    session.save('boom', { :bomb =\u003e 'ball' }, 10) # saving a ruby object\n    puts session.ttl('boom') # should return the seconds left to the key to live\n                             # or -1\n\n    session.expire('key', 60)   # the key will be gone in 60 seconds\n    puts session.restore('key') # prints 'value'\n\n    puts 'has value' if session.value? 'key' # check if key has a value\n\n    session.delete('key')       # deleted it before time :)\n                                # it's alias to remove\n\n    puts 'still here' if session.key? 'key' # do we have the key ?\n    ret = session.scan_by do |x|\n       next unless x.kind_of? Hash\n       next unless x.key? :click\n   \n       x[:click] == true\n    end\n\nLICENSE\n-------\nThe following library is brought to you using MIT license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fik5%2Fredis_session","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fik5%2Fredis_session","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fik5%2Fredis_session/lists"}