Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8050419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:05:14+00:00 2026-06-05T07:05:14+00:00

Currently, my program have a lot of sessions at memory. Session is the object

  • 0

Currently, my program have a lot of sessions at memory. Session is the object with unsigned int ID, some variables + possible long size std::map (different size from session to session).

I want to unload some sessions to disk, but does not know how to organize structure on the disk to have opportunity for fast session finding on disk to load it when need. How to fast find session by ID on disk? Maybe some indexes, but does not know how to use them… or maybe some additional variable?

*SQL Database * is not my variant, because stability, resource overuse, portability, compability etc. etc. etc. need to organize something like other databases do on disk.

thanks, and sorry for my english. please, edit my text if it have mistakes

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:05:15+00:00Added an answer on June 5, 2026 at 7:05 am

    Why on so many sites such as this do so many answer a simple question with, “Why do you want to do that?” or offer alternatives that are not answering the person? (Read the “Your Answer” box at the bottom of this page) It may be that there are better ways, or the person is pretty much wasting their time. But, they may be trying just for the fun of trying and coming up with a solution no matter how well it functions. @abrahab obviously wants to have a go at doing this (and he’s tried to make that very clear) so let him, just answer his question or if you don’t know the answer keep quiet.

    @abrahab, one way is to use a binary file format to store the session data. Use a btree index for the session ids (Google btree) saved in a separate file, the value stored in the btree under each session id is a file pointer to the position in the data file where the binary record starts. The first bytes (short int, int, long) read from the file tell you the length of the record in bytes, read in those bytes and process them. Up to you to define the format of the session record (struct, whatever). If you edit/delete/insert a record you must update the btree for that record and any record being re-positioned within the data file.

    It’s easier to use a DB but if this is what you want to do this will work and performance should be very good. If you want to search for specific values within the record you could build another btree with those values but that would be when to seriously consider going down the DB route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently just starting my first Lua program and I have a .csv file
I am currently trying to build a program where I have a recursive function
I currently have two threads running in my program: Main thread - Grabs image
I currently have a basic chat program in c++ that uses WinSock2.h with UDP.
Say I have a command line C program which is currently executing, and I
I have a python program that I am currently working on which is working
We have an app that currently installs itself into 'program files\our app', and it
I have a cd , dvd. book media program. Currently, i am trying to
I have a program with which dreamlax worked a lot with me on, which
I have a program for some scientific simulation stuff, and as such needs to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.